How to use Unit Tests with Indicators?
Created at 16 Nov 2018, 19:52
How to use Unit Tests with Indicators?
16 Nov 2018, 19:52
Hi all,
I'm getting started with unit tests and am having trouble setting up a working test.
My goal here is to set up a basic test to verify secondary calculations in a custom indicator...
For example there is a basic function in my indicator
private bool IsValid_ArrayLength(bool[] criteria) { int criteriaLength = criteria.Count(); bool lengthIsOk = criteriaLength == NumberOfFactors; return lengthIsOk; }
which I want to test.
But how do I set up the unit test?
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; using cAlgo.Indicators; using Xunit; namespace calgo.Tests { public class indTradeSuccessTests { [Theory] [InlineData(0)] public void CalcHoldTime_ShouldReturnTimeSpan(double holdTime ) { //Arrange var indToCheck = new cAlgo.Indicators.GetIndicators<indTradeSuccess>(); //Act //Assert } } }
Any help appreciated
Mikro