コード例 #1
0
		public void ThrowFormatExceptionIfInputIsInBadFormat()
		{
			var sut = new DateTimeParser();

			string invalidDateTimeText = "10/21/2015";
			Assert.Throws<FormatException>(() => sut.Parse(invalidDateTimeText));
		}
コード例 #2
0
		public void TestThatValidDateTimeTextParsesSuccesfully(string input, int expectedYear, int expectedMonth, int expectedDay)
		{
			var sut = new DateTimeParser();

			var expected = new DateTime(expectedYear, expectedMonth, expectedDay);
			var actual = sut.Parse(input);
			_output.WriteLine("Expected: {0}\nActual: {1}", expected, actual);

			Assert.Equal(expected, actual);
		}