public void CreateWithNullContextDoesNotThrow()
        {
            // Arrange
            var sut = new CurrentDateTimeGenerator();
            // Act & assert
            var dummyRequest = new object();

            Assert.Null(Record.Exception(() => sut.Create(dummyRequest, null)));
        }
示例#2
0
        public void CreateWithNullContextDoesNotThrow()
        {
            // Fixture setup
            var sut = new CurrentDateTimeGenerator();
            // Exercise system and verify outcome
            var dummyRequest = new object();

            Assert.DoesNotThrow(() => sut.Create(dummyRequest, null));
            // Teardown
        }
        public void CreateWithNullRequestWillReturnCorrectResult()
        {
            // Arrange
            var sut = new CurrentDateTimeGenerator();
            // Act
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(null, dummyContainer);

            // Assert
            Assert.Equal(new NoSpecimen(), result);
        }
示例#4
0
        public void CreateWithNullRequestWillReturnCorrectResult()
        {
            // Fixture setup
            var sut = new CurrentDateTimeGenerator();
            // Exercise system
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(null, dummyContainer);

            // Verify outcome
            Assert.Equal(new NoSpecimen(), result);
            // Teardown
        }
        public void CreateWithNonDateTimeRequestWillReturnCorrectResult()
        {
            // Arrange
            var nonDateTimeRequest = new object();
            var sut = new CurrentDateTimeGenerator();
            // Act
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(nonDateTimeRequest, dummyContainer);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
        public void CreateWithDateTimeRequestReturnsCorrectResult()
        {
            // Arrange
            var before          = DateTime.Now;
            var dateTimeRequest = typeof(DateTime);
            var sut             = new CurrentDateTimeGenerator();
            // Act
            var dummyContext = new DelegatingSpecimenContext();
            var result       = sut.Create(dateTimeRequest, dummyContext);
            // Assert
            var after = DateTime.Now;
            var dt    = Assert.IsAssignableFrom <DateTime>(result);

            Assert.True(before <= dt && dt <= after);
        }
示例#7
0
        public void CreateWithDateTimeRequestReturnsCorrectResult()
        {
            // Fixture setup
            var before          = DateTime.Now;
            var dateTimeRequest = typeof(DateTime);
            var sut             = new CurrentDateTimeGenerator();
            // 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
        }
示例#8
0
        public void CreateWithNonDateTimeRequestWillReturnCorrectResult()
        {
            // Fixture setup
            var nonDateTimeRequest = new object();
            var sut = new CurrentDateTimeGenerator();
            // Exercise system
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(nonDateTimeRequest, dummyContainer);

            // Verify outcome
#pragma warning disable 618
            var expectedResult = new NoSpecimen(nonDateTimeRequest);
#pragma warning restore 618
            Assert.Equal(expectedResult, result);
            // Teardown
        }