Exemplo n.º 1
0
        public void NewGuid()
        {
            // Arrange
            var stubGuidProvider = new Fakes.StubIGuidProvider
            {
                NewGuid = () => Guid.Parse("00000000-0000-0000-0000-000000001234")
            };
            var componentUnderTest = new AdjustableNetworkContext(o => o, stubGuidProvider);

            // Act
            var actual = componentUnderTest.NewGuid;

            // Assert
            actual.ShouldHaveSameValueAs(Guid.Parse("00000000-0000-0000-0000-000000001234"));
        }
Exemplo n.º 2
0
        public void CurrentDate_DefaultDateTime()
        {
            using (ShimsContext.Create())
            {
                // Arrange
                var expected           = new DateTime(2000, 1, 2);
                var componentUnderTest = new AdjustableNetworkContext(o => o.AddDays(1), null);
                System.Fakes.ShimDateTime.NowGet = () => expected;

                // Act
                var actual = componentUnderTest.CurrentDate;

                // Assert
                actual.ShouldHaveSameValueAs(new DateTime(2000, 1, 3));
            }
        }
Exemplo n.º 3
0
        public void CurrentDateTime_SetAdditionalDateTimeAdjuster()
        {
            using (ShimsContext.Create())
            {
                // Arrange
                var expected           = new DateTime(2000, 1, 2, 3, 4, 5);
                var componentUnderTest = new AdjustableNetworkContext(o => o.AddHours(1), null);
                System.Fakes.ShimDateTime.NowGet = () => expected;

                // Act
                componentUnderTest.SetAdditionalDateTimeAdjuster(o => o.AddMinutes(2));
                var actual = componentUnderTest.CurrentDateTime;

                // Assert
                actual.ShouldHaveSameValueAs(new DateTime(2000, 1, 2, 4, 6, 5));
            }
        }