Esempio n. 1
0
        public void Can_use_Today_class_with_seconds()
        {
            var time     = Today.At(09, 01, 05);
            var expected = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 09, 01, 05);

            time.ShouldBe(expected);
        }
Esempio n. 2
0
        public void When_datetime_is_within_specified_number_of_milliseconds_from_another_value_it_should_succeed()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            DateTime time       = Today.At(12, 15, 31, 035);
            DateTime nearbyTime = Today.At(12, 15, 31);

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            Action act = () => time.Should().BeCloseTo(nearbyTime, 35);

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            act.ShouldNotThrow();
        }
Esempio n. 3
0
        public void When_datetime_is_greater_then_but_close_to_another_value_it_should_succeed()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            DateTime time       = Today.At(12, 15, 31, 020);
            DateTime nearbyTime = Today.At(12, 15, 31);

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            Action act = () => time.Should().BeCloseTo(nearbyTime);

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            act.ShouldNotThrow();
        }
Esempio n. 4
0
        public void When_a_null_date_time_is_asserted_to_be_close_to_another_it_should_throw()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            DateTime?time       = null;
            DateTime nearbyTime = Today.At(12, 15, 31);

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            Action act = () => time.Should().BeCloseTo(nearbyTime, 35);

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            act.ShouldThrow <AssertFailedException>()
            .WithMessage("Expected*, but found <null>.");
        }
Esempio n. 5
0
        public void Dates_1()
        {
            The.Year(2006).On.May.The10th.At(09, 00);

            On.July.The21st.At(07, 00);

            var aug11 = August.The11th;

            July.The(1);

            November.The(10);

            The.Year(2008).On.January.The10th.At(05, 49, 38);

            var created = On.May.The14th;

            Today.At(09, 00);

            // (These generate TimeSpans)
            The.Time(08, 31);
            At.Time(09, 46);
        }
Esempio n. 6
0
        public void Can_use_Today_class_with_seconds()
        {
            var time = Today.At(09, 01, 05);

            Assert.That(time, Is.EqualTo(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 09, 01, 05)));
        }
Esempio n. 7
0
        public void Using_Today()
        {
            var date = Today.At(09, 00);

            Assert.That(date, Is.EqualTo(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 09, 00, 00)));
        }
Esempio n. 8
0
 public void Today_Time_can_be_specified_with_At()
 {
     Assert.That(Today.At(14), Is.EqualTo(8.May(2011).At(14)));
     Assert.That(Today.At(14, 30), Is.EqualTo(8.May(2011).At(14, 30)));
     Assert.That(Today.At(14, 30, 26), Is.EqualTo(8.May(2011).At(14, 30, 26)));
 }
Esempio n. 9
0
        public void Using_Today()
        {
            var date = Today.At(09, 00);

            date.ShouldBe(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 09, 00, 00));
        }