Esempio n. 1
0
        public void AddTimeProvider_ShouldPermitTwoProvidersOfTheSameType()
        {
            TemporalTime.AddTimeProvider(new TestTimeProvider());
            TemporalTime.AddTimeProvider(new TestTimeProvider());

            Assert.Equal(2, TemporalTime.TimeProviders.Count());
        }
Esempio n. 2
0
        public void CurrentTimeProvider_ReturnsTheTimeFromTheFirstTimeProviderWithTheTime()
        {
            TemporalTime.AddTimeProvider(new NoTimeTestTimeProvider());
            TemporalTime.AddTimeProvider(new TestTimeProvider());

            Assert.IsType <TestTimeProvider>(TemporalTime.CurrentTimeProvider);
        }
Esempio n. 3
0
        public void IsFrozen_ReturnsTrueWhenCookieProviderReturnsValue()
        {
            var cookieTimeProvider = new CookieTimeProvider(new TestCookieService(DateTime.Now.ToString("o")));

            TemporalTime.AddTimeProvider(cookieTimeProvider);

            Assert.True(TemporalTime.IsFrozen);
        }
Esempio n. 4
0
        public void IsFrozen_ReturnsFalseWhenCookieProviderReturnsNull()
        {
            var cookieTimeProvider = new CookieTimeProvider(new TestCookieService(null));

            TemporalTime.AddTimeProvider(cookieTimeProvider);

            Assert.False(TemporalTime.IsFrozen);
        }
Esempio n. 5
0
        public void UtcNow_ThrowsWhenNoTimeProvidersHaveTheTime()
        {
            TemporalTime.AddTimeProvider(new NoTimeTestTimeProvider());

            Assert.Throws <ApplicationException>(() =>
            {
                var now = TemporalTime.UtcNow;
            });
        }
Esempio n. 6
0
        public void ClearTimeProviders_ShouldClearAllTimeProviders()
        {
            TemporalTime.AddTimeProvider(new TestTimeProvider());

            Assert.Equal(1, TemporalTime.TimeProviders.Count());

            TemporalTime.ClearTimeProviders();

            Assert.False(TemporalTime.TimeProviders.Any());
        }
Esempio n. 7
0
        public void IsFrozen_ReturnsFalseWhenSystemClockProviderReturnsValue()
        {
            TemporalTime.AddTimeProvider(new SystemClockProvider());

            Assert.False(TemporalTime.IsFrozen);
        }
Esempio n. 8
0
        public void CurrentTimeProvider_ReturnsNullWhenNoTimeProvidersHaveTheTime()
        {
            TemporalTime.AddTimeProvider(new NoTimeTestTimeProvider());

            Assert.Null(TemporalTime.CurrentTimeProvider);
        }
Esempio n. 9
0
        public void AddTimeProvider_ShouldAddExpectedTimeProvider()
        {
            TemporalTime.AddTimeProvider(new TestTimeProvider());

            Assert.Equal(TestTimeProvider.DefaultNow, TemporalTime.TimeProviders.Single().Now);
        }
Esempio n. 10
0
        public void UtcNow_ReturnsTheTimeFromTheFirstTimeProviderWithTheTime()
        {
            TemporalTime.AddTimeProvider(new TestTimeProvider());

            Assert.Equal(TestTimeProvider.DefaultUtcNow, TemporalTime.UtcNow);
        }