public void Test_GetRandomDecimal_ShouldReturnDecimal() { //---------------Set up test pack------------------- //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var randomDecimal = RandomValueGen.GetRandomDecimal(); //---------------Test Result -----------------------G Assert.IsNotNull(randomDecimal); Assert.AreNotEqual(RandomValueGen.GetRandomDecimal(), randomDecimal, "Should not ret same value twice"); }
public void Construct_GivenDecimalValue_ToDecimalAlwaysReturnsThatValue() { //---------------Set up test pack------------------- var input = RandomValueGen.GetRandomDecimal(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var decorated = new DecimalDecorator(input); var result = decorated.ToDecimal(); //---------------Test Result ----------------------- Assert.AreEqual(input, result); }
public void Test_GetRandomDecimal_WhenMinGTMax_ShouldReturnMinValue() { //---------------Set up test pack------------------- const decimal maxValue = 0; const decimal minValue = decimal.MaxValue - decimal.MaxValue / 2; //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var randomDecimal = RandomValueGen.GetRandomDecimal(minValue, maxValue); //---------------Test Result -----------------------G Assert.IsNotNull(randomDecimal); Assert.Greater(randomDecimal, minValue); }
public void Test_GetRandomDecimalWhenMinValueAndMaxValue_ShouldReturnDecimalWithinRange() { //---------------Set up test pack------------------- const decimal maxValue = decimal.MaxValue; const decimal minValue = decimal.MinValue; //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var randomDecimal = RandomValueGen.GetRandomDecimal(minValue, maxValue); //---------------Test Result -----------------------G Assert.IsNotNull(randomDecimal); Assert.Greater(randomDecimal, minValue); Assert.LessOrEqual(randomDecimal, maxValue); }
public void Construct_GivenStringDecimalWithPeriodFormatting_ToStringReturnsThatValue() { //---------------Set up test pack------------------- var nfi = new NumberFormatInfo() { CurrencyDecimalSeparator = ".", NumberDecimalSeparator = ".", PercentDecimalSeparator = ".", CurrencyGroupSeparator = "", NumberGroupSeparator = "", PercentGroupSeparator = "" }; var input = RandomValueGen.GetRandomDecimal().ToString(nfi); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var decorated = new DecimalDecorator(input); var result = decorated.ToString(); //---------------Test Result ----------------------- Assert.AreEqual(result, input); }