Exemplo n.º 1
0
        public void LogTime_ValidInput_Success()
        {
            FakeUserLogger     userLogger  = new FakeUserLogger();
            FakeTaskManager    taskManager = new FakeTaskManager();
            FakeTaskAlwaysTrue task        = new FakeTaskAlwaysTrue();
            FakeEmailSender    emailSender = new FakeEmailSender();

            TimeLogger time = new TimeLogger(userLogger, taskManager, task, emailSender, null);

            time.LogTime(2, 30, "Working on TimesheetApp");

            StringAssert.Contains("Time logged successfully", emailSender.Title);
        }
Exemplo n.º 2
0
        public void LogTime_SendEmailError_BadData_Fail()
        {
            FakeUserLogger userLogger = new FakeUserLogger();

            userLogger.badEmail = "*****@*****.**";
            FakeTaskManager    taskManager = new FakeTaskManager();
            FakeTaskAlwaysTrue task        = new FakeTaskAlwaysTrue();
            IEmailSender       emailSender = Substitute.For <IEmailSender>();

            TimeLogger time = new TimeLogger(userLogger, taskManager, task, emailSender, null);

            time.LogTime(2, 30, "Working on TimesheetApp");

            emailSender.DidNotReceive().SendEmail("*****@*****.**", "Time logged successfully", "2 hours and 30 minutes successfully logged to task with ID=100");
        }