public void Is_Not_Leap_Year_Returns_False(int year) { // Arrange // Act var result = DateTimeInt.IsLeapYear(year); // Assert Assert.False(result); }
public void From_Null_Or_Empty_String_Returns_Zeroes(string input) { // Arrange // Act var result = new DateTimeInt(input); // Assert Assert.Equal("000000000000", result.ToString()); }
public void Valid_Returns_True() { // Arrange var input = new DateTimeInt(2020, 1, 2, 3, 4); // Act var(valid, _) = input.IsValidDateTime(); // Assert Assert.True(valid); }
public void From_Integers_Sets_Values() { // Arrange const string expected = "200001020304"; // Act var result = new DateTimeInt(2000, 1, 2, 3, 4); // Assert Assert.Equal(expected, result.ToString()); }
public void From_Valid_Long_Sets_Values() { // Arrange const long input = 200001020304; // Act var result = new DateTimeInt(input); // Assert Assert.Equal(input.ToString(), result.ToString()); }
public void Valid_Returns_String_Value() { // Arrange const string expected = "200001020304"; var input = new DateTimeInt(expected); // Act var result = input.ToString(); // Assert Assert.Equal(expected, result); }
#pragma warning disable xUnit1026 // Theory methods should use all of their parameters public void Invalid_Returns_Zeroes(int year, int month, int day, int hour, int minute, string _) #pragma warning restore xUnit1026 // Theory methods should use all of their parameters { // Arrange var input = new DateTimeInt(year, month, day, hour, minute); // Act var result = input.ToString(); // Assert Assert.Equal("000000000000", result); }
public void Invalid_Returns_False_And_Part(int year, int month, int day, int hour, int minute, string part) { // Arrange var input = new DateTimeInt(year, month, day, hour, minute); // Act var(valid, invalidPart) = input.IsValidDateTime(); // Assert Assert.False(valid); Assert.Equal(part, invalidPart); }
public void Invalid_DateTime_Returns_None(int year, int month, int day, int hour, int minute, string part) { // Arrange var input = new DateTimeInt(year, month, day, hour, minute); // Act var result = input.ToDateTime(); // Assert var none = result.AssertNone().AssertType <InvalidDateTimeMsg>(); Assert.Equal(part, none.Value.part); }
public void Valid_DateTime_Returns_Some() { // Arrange var dt = new DateTime(2000, 1, 2, 3, 4, 0); var input = new DateTimeInt(dt); // Act var result = input.ToDateTime(); // Assert var some = result.AssertSome(); Assert.Equal(dt, some); }