コード例 #1
0
        public void CreateWithNullContextDoesNotThrow()
        {
            // Fixture setup
#pragma warning disable 618
            var sut = new DateTimeGenerator();
#pragma warning restore 618
            // Exercise system and verify outcome
            var dummyRequest = new object();
            Assert.DoesNotThrow(() => sut.Create(dummyRequest, null));
            // Teardown
        }
コード例 #2
0
        public void SutIsSpecimenBuilder()
        {
            // Fixture setup
            // Exercise system
#pragma warning disable 618
            var sut = new DateTimeGenerator();
#pragma warning restore 618
            // Verify outcome
            Assert.IsAssignableFrom<ISpecimenBuilder>(sut);
            // Teardown
        }
コード例 #3
0
        public void CreateWithNullRequestWillReturnCorrectResult()
        {
            // Fixture setup
#pragma warning disable 618
            var sut = new DateTimeGenerator();
#pragma warning restore 618
            // Exercise system
            var dummyContainer = new DelegatingSpecimenContext();
            var result = sut.Create(null, dummyContainer);
            // Verify outcome
            Assert.Equal(new NoSpecimen(), result);
            // Teardown
        }
コード例 #4
0
        public void CreateWithDateTimeRequestReturnsCorrectResult()
        {
            // Fixture setup
            var before = DateTime.Now;
            var dateTimeRequest = typeof(DateTime);
#pragma warning disable 618
            var sut = new DateTimeGenerator();
#pragma warning restore 618
            // Exercise system
            var dummyContext = new DelegatingSpecimenContext();
            var result = sut.Create(dateTimeRequest, dummyContext);
            // Verify outcome
            var after = DateTime.Now;
            var dt = Assert.IsAssignableFrom<DateTime>(result);
            Assert.True(before <= dt && dt <= after);
            // Teardown
        }