示例#1
0
    public void saveResultTestInvalidInput()
    {
        String input   = "Invalid input";
        String message = CreateReportMock.saveResult(ref input, 12);

        StringAssert.StartsWith("Something went wrong", message);
    }
示例#2
0
    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);
    }
示例#3
0
    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);
    }
示例#4
0
    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();
        }
    }