public void saveResultTestInvalidInput() { String input = "Invalid input"; String message = CreateReportMock.saveResult(ref input, 12); StringAssert.StartsWith("Something went wrong", message); }
public void saveAlreadyAddedResultTest() { String day = DateTime.Today.Day.ToString("00"); String month = DateTime.Today.Month.ToString("00"); String year = DateTime.Today.Year.ToString(); int result = 12; String temp = day + "-" + month + "-" + year + " " + result.ToString(); String message = CreateReportMock.saveResult(ref temp, result); StringAssert.Contains("already added", message); }
public void saveFirstResultTest() { String input = ""; int result = 12; String message = CreateReportMock.saveResult(ref input, result); StringAssert.StartsWith("Score added", message); String day = DateTime.Today.Day.ToString("00"); String month = DateTime.Today.Month.ToString("00"); String year = DateTime.Today.Year.ToString(); StringAssert.AreEqualIgnoringCase(day + "-" + month + "-" + year + " " + result.ToString(), input); }
public void saveResultSuccessfullyTest() { if (DateTime.Today.Day != 1) { DateTime yesterday = DateTime.Today.AddDays(-1); String dayYesterday = yesterday.Day.ToString(); String monthYesterday = yesterday.Month.ToString(); String yearYesterday = yesterday.Year.ToString(); int result = 12; String tempYesterday = dayYesterday + "-" + monthYesterday + "-" + yearYesterday + " " + result.ToString(); String message = CreateReportMock.saveResult(ref tempYesterday, result + 1); StringAssert.StartsWith("Score added", message); StringAssert.EndsWith((result + 1).ToString(), tempYesterday); } else { saveFirstResultTest(); } }