public void SuccessfullyCalculateCosineOfPositiveAngle() { var value = 60; var function = new CosineFunction(); var phase = function.Calculate(); Assert.NotNull(phase); Assert.Equal("Specify Argument", phase.Name); Assert.Equal("Specify angle to find the cosine of.", phase.Description); Assert.Collection(phase.Inputs, i => { Assert.Equal("Angle", i.Info.Name); Assert.Null(i.Info.Description); Assert.Equal(new RadianUnit(), i.Info.Unit); }); phase.Inputs[0].Value = value; Assert.Null(function.Calculate(phase)); Assert.Collection(function.CurrentResult, i => { Assert.Equal(typeof(double), i.ValueType); Assert.Equal(Math.Cos(value), TypeConverter.ToObject <double>(i.Value)); }); }
public void SuccessfullyCalculateCosineWithNoAngleSpecified() { var function = new CosineFunction(); var phase = function.Calculate(); Assert.NotNull(phase); Assert.Null(function.Calculate(phase)); Assert.Collection(function.CurrentResult, i => { Assert.Equal(typeof(double), function.CurrentResult[0].ValueType); Assert.Equal(Math.Cos(0.0), TypeConverter.ToObject <double>(function.CurrentResult[0].Value)); }); }
public void FractionalArgument_Calculate_ResultMastBeNumber() { var variableCosine = new CosineFunction(); var result = variableCosine.Calculate(99.025); Assert.AreEqual(result, 0.064, 0.001); }
public void ArgumentOfMinus_Calculate_ResultMustBeNumber() { var variableCosine = new CosineFunction(); var result = variableCosine.Calculate(-3); Assert.AreEqual(result, -0.99, 0.001); }
public void SuccessfullyCalculateCosineOfNegativeAngle() { var value = -54; var function = new CosineFunction(); var phase = function.Calculate(); Assert.NotNull(phase); phase.Inputs[0].Value = value; Assert.Null(function.Calculate(phase)); Assert.Collection(function.CurrentResult, i => { Assert.Equal(typeof(double), i.ValueType); Assert.Equal(Math.Cos(value), TypeConverter.ToObject <double>(i.Value)); }); }
public void TestCosine() { //Arrange VariableNode variableNode = new VariableNode(); PiNode piNode = new PiNode(); CosineFunction cosineNode1 = new CosineFunction(variableNode); CosineFunction cosineNode2 = new CosineFunction(piNode); //Act double result1 = cosineNode1.Calculate(0); double result2 = cosineNode2.Calculate(0); //Assert Assert.AreEqual(1, result1); Assert.AreEqual(-1, result2); }
public void ArgumentZero_Calculate_ResultMustBeUnit() { var variableCosine = new CosineFunction(); Assert.AreEqual(1, variableCosine.Calculate(0)); }