public void NonNumericThrows() { //Arrange string input = "aaa"; IntegerTime testObj; //Act testObj = new IntegerTime(input); //Assert //Throws }
public void SQLCtor_GivesCorrectHour_ShortHour() { //Arrange string input = "85023"; int expected = 8; IntegerTime testObj; //Act testObj = new IntegerTime(input); //Assert Assert.AreEqual(expected, testObj.Hour); }
public void DateTimeCtor_GivesCorrectHour() { //Arrange DateTime input = new DateTime(2018, 5, 16, 14, 26, 1); int expected = 14; IntegerTime testObj; //Act testObj = new IntegerTime(input); //Assert Assert.AreEqual(expected, testObj.Hour); }
public void ToString_Correct() { //Arrange string input = "82536"; string expected = "82536"; IntegerTime testObj; //Act testObj = new IntegerTime(input); //Assert Assert.AreEqual(expected, testObj.ToString()); }
public void ToInt32_Correct() { //Arrange string input = "82536"; int expected = 82536; IntegerTime testObj; //Act testObj = new IntegerTime(input); //Assert Assert.AreEqual(expected, testObj.ToInt); }
public void ToTimeSpan() { //Arrange string input = "85023"; TimeSpan expected = new TimeSpan(08, 50, 23); IntegerTime testObj; //Act testObj = new IntegerTime(input); //Assert Assert.AreEqual(expected, testObj.ToTimeSpan); }
public void SQLCtor_GivesCorrectSecond() { //Arrange string input = "85023"; int expected = 23; IntegerTime testObj; //Act testObj = new IntegerTime(input); //Assert Assert.AreEqual(expected, testObj.Second); }
public void SQLCtor_GivesCorrectMinute() { //Arrange string input = "85023"; int expected = 50; IntegerTime testObj; //Act testObj = new IntegerTime(input); //Assert Assert.AreEqual(expected, testObj.Minute); }
public void SQLCtor_ZeroInputWorks() { //Arrange string input = "0"; IntegerTime testObj; //Act testObj = new IntegerTime(input); //Assert Assert.AreEqual(0, testObj.Hour); Assert.AreEqual(0, testObj.Minute); Assert.AreEqual(0, testObj.Second); }
public void IntCtor_GivesCorrectHourMinuteSecond() { //Arrange int expectedHour = 10; int expectedMinute = 11; int expectedSecond = 12; int input = (expectedHour * 10000) + (expectedMinute * 100) + expectedSecond; IntegerTime testObj; //Act testObj = new IntegerTime(input); //Assert Assert.AreEqual(expectedHour, testObj.Hour); Assert.AreEqual(expectedMinute, testObj.Minute); Assert.AreEqual(expectedSecond, testObj.Second); }
public void IntegerTimeReadmeTest() { // Find date components IntegerTime fromString = new IntegerTime("010203"); Assert.AreEqual(1, fromString.Hour); Assert.AreEqual(2, fromString.Minute); Assert.AreEqual(3, fromString.Second); IntegerTime fromInt = new IntegerTime(101112); Assert.AreEqual(10, fromInt.Hour); Assert.AreEqual(11, fromInt.Minute); Assert.AreEqual(12, fromInt.Second); // Convert Assert.AreEqual(10203, fromString.ToInt); Assert.AreEqual("101112", fromInt.ToString()); Assert.AreEqual(10, fromInt.ToTimeSpan.Hours); Assert.AreEqual(11, fromInt.ToTimeSpan.Minutes); Assert.AreEqual(12, fromInt.ToTimeSpan.Seconds); }