Example #1
0
 public void CreateRandomNullableValue_GivenType_ShouldNotThrowExceptionAndCreateRandomValue(Type objectType, Type expectedType)
 {
     //---------------Set up test pack-------------------
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     Assert.DoesNotThrow(() =>
     {
         var randomValue = RandomValueGenerator.CreateRandomValue(objectType);
         //---------------Test Result -----------------------
         randomValue.Should().NotBeNull();
         randomValue.Should().BeOfType(expectedType);
     });
 }
Example #2
0
        public void CreateRandomDate_GivenMultipleCalls_ShouldyCreateRandomDates()
        {
            //---------------Set up test pack-------------------
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            var randomDate1 = RandomValueGenerator.CreateRandomValue(typeof(DateTime));
            var randomDate2 = RandomValueGenerator.CreateRandomValue(typeof(DateTime));
            var randomDate3 = RandomValueGenerator.CreateRandomValue(typeof(DateTime));

            //---------------Test Result -----------------------
            randomDate1.Should().NotBeSameAs(randomDate2);
            randomDate1.Should().NotBeSameAs(randomDate3);
            randomDate2.Should().NotBeSameAs(randomDate3);
        }