public void IniciarJornadaConError( [Frozen]Mock<HttpContextBase> httpContextMock, [Frozen]Mock<IIdentity> identityMock, [Frozen]Mock<IJornadaService> serviceMock, [Frozen]Mock<IJornadaQueries> queriesMock, string usuario, InvalidOperationException exception) { identityMock.Setup(x => x.Name).Returns(usuario); serviceMock.Setup(s => s.IniciarJornada(usuario)).Throws(exception); var sut = new SituacionController(serviceMock.Object, queriesMock.Object); sut.ControllerContext = new ControllerContext(httpContextMock.Object, new RouteData(), sut); var response = sut.IniciarJornada(); response.RouteValues["action"].Should().Be("Actual"); sut.TempData.Should().ContainKey("error"); sut.TempData["error"].Should().Be(exception.Message); }
public void IniciarJornadaSinError( [Frozen]Mock<HttpContextBase> httpContextMock, [Frozen]Mock<IIdentity> identityMock, [Frozen]Mock<IJornadaService> serviceMock, [Frozen]Mock<IJornadaQueries> queriesMock, string usuario) { identityMock.Setup(x => x.Name).Returns(usuario); var sut = new SituacionController(serviceMock.Object, queriesMock.Object); sut.ControllerContext = new ControllerContext(httpContextMock.Object, new RouteData(), sut); var response = sut.IniciarJornada(); response.RouteValues["action"].Should().Be("Actual"); sut.TempData.Should().BeEmpty(); }