public void GetCustomersWhereFirstLoggedInParametersConstructsCorrectObjectWithJustValidEndDate() { // Arrange var endDate = DateTime.UtcNow.ToString(); // Act var result = new GetCustomersWhereFirstLoggedInParameters(null, endDate); // Assert Assert.IsFalse(result.Start.HasValue); Assert.IsTrue(result.End.HasValue); Assert.AreEqual(endDate, result.End.Value.ToString()); }
public void GetCustomersWhereFirstLoggedInParametersConstructsCorrectObjectWithValidStartAndEndDates() { // Arrange var startDate = DateTime.UtcNow.ToString(); var endDate = DateTime.UtcNow.ToString(); // Act var result = new GetCustomersWhereFirstLoggedInParameters(startDate, endDate); // Assert Assert.IsTrue(result.Start.HasValue, "Start date expected to have a value."); Assert.IsTrue(result.End.HasValue, "End date expected to have a value."); Assert.AreEqual(startDate, result.Start.Value.ToString(), "Start date is incorrect."); Assert.AreEqual(endDate, result.End.Value.ToString(), "End date is incorrect."); }
public void GetCustomersWhereFirstLoggedInParametersConstructsCorrectObjectWithNoDatesSupplied() { // Arrange var expectedStartDate = DateTime.UtcNow.Date.AddDays(-1).ToString(); var expectedEndDate = DateTime.UtcNow.Date.ToString(); // Act var result = new GetCustomersWhereFirstLoggedInParameters(null, null); // Assert Assert.IsTrue(result.Start.HasValue, "Start date expected to have a value."); Assert.IsTrue(result.End.HasValue, "End date expected to have a value."); Assert.AreEqual(expectedStartDate, result.Start.Value.ToString(), "Start date has incorrect value."); Assert.AreEqual(expectedEndDate, result.End.Value.ToString(), "End date has incorrect value."); }
public void GetCustomersWhereFirstLoggedInParametersThrowsExceptionWhenEndDateIsInvalidDate() { // Act Exception caughtException = null; try { var result = new GetCustomersWhereFirstLoggedInParameters(null, "i-am-not-a-date"); } catch (Exception ex) { caughtException = ex; } // Assert Assert.IsNotNull(caughtException); Assert.IsInstanceOfType(caughtException, typeof(InvalidDateException)); }