Ejemplo n.º 1
0
        public void EqualToTest()
        {
            var matchers = Matchers
                           (
                ATimeSpan.EqualTo(TimeSpan.FromSeconds(5)),
                ATimeSpan.EqualTo(5).Seconds(),
                ATimeSpan.EqualTo(5000).Milliseconds()
                           );

            foreach (var matcher in matchers)
            {
                AssertFails(TimeSpan.FromSeconds(4), matcher);
                AssertFails(TimeSpan.FromSeconds(4), matcher);

                AssertPasses(TimeSpan.FromSeconds(5), matcher);
                AssertPasses(TimeSpan.FromSeconds(5), matcher);
                AssertPasses(TimeSpan.FromMilliseconds(5000), matcher);

                AssertFails(TimeSpan.FromSeconds(6), matcher);
                AssertFails(TimeSpan.FromSeconds(6), matcher);
            }
        }
Ejemplo n.º 2
0
        public void FluentSingleArgMatcherTest()
        {
            AssertFails(TimeSpan.FromSeconds(4), ATimeSpan.EqualTo(5000).Milliseconds());
            AssertPasses(TimeSpan.FromSeconds(5), ATimeSpan.EqualTo(5000).Milliseconds());
            AssertFails(TimeSpan.FromSeconds(6), ATimeSpan.EqualTo(5000).Milliseconds());


            AssertFails(TimeSpan.FromSeconds(4), ATimeSpan.EqualTo(5).Seconds());
            AssertPasses(TimeSpan.FromSeconds(5), ATimeSpan.EqualTo(5).Seconds());
            AssertFails(TimeSpan.FromSeconds(6), ATimeSpan.EqualTo(5).Seconds());

            AssertFails(TimeSpan.FromMinutes(4), ATimeSpan.EqualTo(5).Minutes());
            AssertPasses(TimeSpan.FromMinutes(5), ATimeSpan.EqualTo(5).Minutes());
            AssertFails(TimeSpan.FromMinutes(6), ATimeSpan.EqualTo(5).Minutes());


            AssertFails(TimeSpan.FromHours(4), ATimeSpan.EqualTo(5).Hours());
            AssertPasses(TimeSpan.FromHours(5), ATimeSpan.EqualTo(5).Hours());
            AssertFails(TimeSpan.FromHours(6), ATimeSpan.EqualTo(5).Hours());

            AssertFails(TimeSpan.FromDays(4), ATimeSpan.EqualTo(5).Days());
            AssertPasses(TimeSpan.FromDays(5), ATimeSpan.EqualTo(5).Days());
            AssertFails(TimeSpan.FromDays(6), ATimeSpan.EqualTo(5).Days());
        }