public void GetAllPomodoros_TestMethod() { var testPomorodo = new Pomodoro() { Id = Guid.NewGuid(), StartTime = "TestStartTime", FinishTime = "TestFinishTime", Description = "TestDescription" }; var repositoryMock = new Mock <IPomodoroRepository>(); repositoryMock.Setup(pr => pr.GetAllPomodoros()).ReturnsAsync(new List <Pomodoro> { testPomorodo }); var repositoryWrapperMock = new Mock <IRepositoryWrapper>(); repositoryWrapperMock.Setup(rw => rw.Pomodoro).Returns(repositoryMock.Object); var mapperMock = new Mock <IMapper>(); var loggerMock = new Mock <ILoggerManager>(); loggerMock.Setup(pr => pr.LogInfo("Test")); var pc = new PomodoroController(repositoryWrapperMock.Object, mapperMock.Object, loggerMock.Object); var result = pc.GetAllPomodoros().Result; var okResult = result as OkObjectResult; Assert.IsNotNull(okResult); Assert.AreEqual(200, okResult.StatusCode); }
public override void Start(PomodoroController controller) { if (controller.FocusOnText.Length > 0) { SetNextState(controller); } }
public override void Start(PomodoroController controller) { TimeSpan elapsedFullMinutes = new TimeSpan(0, 0, MinutesInState - MinuteCountDown, 0); TimeSpan elapsedTime = PauseTime.Subtract(StartTime).Subtract(PreviousState.TotalPauseTimeSpan); TimeSpan totalPauseTimeSpan = DateTime.Now.Subtract(StartTime).Subtract(elapsedTime); double minuteTimerTimeLeft = MilisecondsPerMinute - elapsedTime.Subtract(elapsedFullMinutes).TotalMilliseconds; Console.WriteLine($"{nameof(Paused)}"); Console.WriteLine($" elapsedFullMinutes = {elapsedFullMinutes.TotalMilliseconds}"); Console.WriteLine($" elapsedTime = {elapsedTime.TotalMilliseconds}"); Console.WriteLine($" totalPauseTimeSpan = {totalPauseTimeSpan.TotalMilliseconds}"); Console.WriteLine($" minuteTimerTimeLeft = {minuteTimerTimeLeft}"); controller.State = PreviousState; controller.State.Start(minuteTimerTimeLeft, totalPauseTimeSpan); }
public override void SetNextState(PomodoroController controller) { controller.State = new LazerFocused(); }
public override void Pause(PomodoroController controller) { PauseImpl(controller); }
public override void SetNextState(PomodoroController controller) { controller.State = new ProgressChecking(); }
public virtual void Start(PomodoroController controller) { throw new InvalidOperationException($"{nameof(Start)} not allowed from state '{GetType().Name}'!"); }
protected void PauseImpl(PomodoroController controller) { controller.State = new Paused(this); }
public override void SetNextState(PomodoroController controller) { controller.State = new Break(); }