public void NoParameters() { // No parameters specified at all var testObject = new TimeWindowBuilder(null, "", ""); Assert.IsNull(testObject.TimeWindowStart); Assert.IsNull(testObject.TimeWindowEnd); }
public void DefaultInput() { // The default input of the UI var testObject = new TimeWindowBuilder(null, "0:00", ""); Assert.IsNull(testObject.TimeWindowStart); Assert.IsNull(testObject.TimeWindowEnd); }
public void NoStartDate_OthersCorrect() { // No start date specified var testObject = new TimeWindowBuilder(null, "1:25", "60"); // Expecting default, as the start date is mandatory for filtering Assert.IsNull(testObject.TimeWindowStart); Assert.IsNull(testObject.TimeWindowEnd); }
public void NoDuration_OthersCorrect() { // No duration specified DateTime?startDate = DateTime.Parse("2019-12-16T00:00:00+02:00"); var testObject = new TimeWindowBuilder(startDate, "12:20", ""); // No duration specified AssertDateTime("2019-12-16T10:20:00Z", testObject.TimeWindowStart.Value); // Expecting a conversion local to UTC here Assert.IsNull(testObject.TimeWindowEnd); }
public void AllParams() { // All parameters are specified and correct DateTime?startDate = DateTime.Parse("2019-12-16T00:00:00+02:00"); var testObject = new TimeWindowBuilder(startDate, "12:20", "30"); AssertDateTime("2019-12-16T10:20:00Z", testObject.TimeWindowStart.Value); // Expecting a conversion local to UTC here AssertDateTime("2019-12-16T10:50:00Z", testObject.TimeWindowEnd.Value); // Expecting a conversion local to UTC here }
public void StartTime_WithLeadingZero() { // Testing a time value with leading zeros DateTime?startDate = DateTime.Parse("2019-12-16T00:00:00+02:00"); var testObject = new TimeWindowBuilder(startDate, "02:20", "30"); // Leading zero in the hours input AssertDateTime("2019-12-16T00:20:00Z", testObject.TimeWindowStart.Value); // Expecting a conversion local to UTC here AssertDateTime("2019-12-16T00:50:00Z", testObject.TimeWindowEnd.Value); // Expecting a conversion local to UTC here }
public void NoStartTime_OthersCorrect() { // No start time specified DateTime?startDate = DateTime.Parse("2019-12-16T00:00:00+02:00"); var testObject = new TimeWindowBuilder(startDate, "", "60"); // Expecting midnight (local time) to be the start AssertDateTime("2019-12-15T22:00:00Z", testObject.TimeWindowStart.Value); // Expecting a conversion local to UTC here AssertDateTime("2019-12-15T23:00:00Z", testObject.TimeWindowEnd.Value); // Expecting a conversion local to UTC here }