コード例 #1
0
        public void AddStringTimeToDateFail1Test(string input)
        {
            // arrange
            var d = new DateTime(214, 1, 2, 0, 0, 0);

            // act
            // assert
            _ = Assert.Throws <InvalidDataException>(() => Sut.AddStringTimeToDate(d, input));
        }
コード例 #2
0
        public void AddStringTimeToDateFail2Test(string input, string expectedMsg)
        {
            // arrange
            var d = new DateTime(214, 1, 2, 0, 0, 0);

            // act
            // assert
            Exception ex = Assert.Throws <InvalidDataException>(() => Sut.AddStringTimeToDate(d, input));

            Assert.Equal(ex.Message, expectedMsg);
        }
コード例 #3
0
        public void AddStringTimeToDateTest(string input, int hour, int min)
        {
            // arrange
            var d = new DateTime(214, 1, 2, 0, 0, 0);

            // act
            DateTime result = Sut.AddStringTimeToDate(d, input);

            // assert
            Assert.Equal(result.Year, d.Year);
            Assert.Equal(result.Month, d.Month);
            Assert.Equal(result.Day, d.Day);
            Assert.Equal(result.Hour, hour);
            Assert.Equal(result.Minute, min);
        }