public void Should_Convert_A_thought_In_A_Todo() { var title = "Title test"; var outcome = "Outcome teste"; SessionSummary value = new SessionSummary(); var sessionMock = new Mock <ISession>(); sessionMock.Setup(_ => _.Set <SessionSummary>("SessionSummary", It.IsAny <SessionSummary>())) .Callback <string, SessionSummary>((k, v) => value = v); sessionMock.Setup(_ => _.Get <SessionSummary>("SessionSummary")).Returns(value); var rmContext = new Mock <HttpContext>(); rmContext.Setup(x => x.Session).Returns(sessionMock.Object); var expectedTodo = new Todo() { Title = title, Completed = false, Topic = Topic.topics.First(), Outcome = outcome }; var thought = new Thought() { Id = 1, Name = title, Topic = Topic.topics.First() }; var sessionSummary = new SessionSummary(); sessionSummary.todos.Add(expectedTodo); var controller = new TodoController(null); var controllerContext = new ControllerContext(); controllerContext.HttpContext = rmContext.Object; controller.ControllerContext = controllerContext; var result = (RedirectToActionResult)controller.Convert(thought, outcome); Assert.Contains(expectedTodo, Todo.ThingsToBoDone); Assert.DoesNotContain(thought, Thought.Thoughts); Assert.Equal("Process", result.ActionName); Assert.Equal("Thought", result.ControllerName); Assert.Equal(sessionSummary, controller.HttpContext.Session.Get <SessionSummary>("SessionSymmary")); }