public void Given() { var sut = new HomeController(A.Dummy<ISendEmail>()); var httpContext = A.Fake<HttpContextBase>(); var httpResponse = A.Fake<HttpResponseBase>(); httpSession = A.Fake<HttpSessionStateBase>(); A.CallTo(() => httpContext.Response).Returns(httpResponse); A.CallTo(() => httpContext.Session).Returns(httpSession); var context = new ControllerContext(new RequestContext(httpContext, new RouteData()), sut); sut.ControllerContext = context; sut.AddCustomerEmailToSession(customerEmail); }
public void Given() { sut = new HomeController(); var httpContext = A.Fake<HttpContextBase>(); var httpRequest = A.Fake<HttpRequestBase>(); var httpResponse = A.Fake<HttpResponseBase>(); A.CallTo(() => httpContext.Request).Returns(httpRequest); A.CallTo(() => httpContext.Response).Returns(httpResponse); var context = new ControllerContext(new RequestContext(httpContext, new RouteData()), sut); sut.ControllerContext = context; var fakeUri = new Uri(uri); A.CallTo(() => sut.ControllerContext.RequestContext.HttpContext.Request.Url).Returns(fakeUri); fullyQualifiedUrl = string.Format("{0}/home/index", uri); sut.Url = A.Fake<UrlHelper>(); A.CallTo(() => sut.Url.Action(A<string>.Ignored, A<string>.Ignored, null, A<string>.Ignored)).Returns(fullyQualifiedUrl); }
public void Given() { var sut = new HomeController(A.Dummy<ISendEmail>()); var httpContext = A.Fake<HttpContextBase>(); httpResponse = A.Fake<HttpResponseBase>(); A.CallTo(() => httpContext.Response).Returns(httpResponse); var context = new ControllerContext(new RequestContext(httpContext, new RouteData()), sut); sut.ControllerContext = context; sut.WriteToResponse(); }
public void Given() { emailSender = A.Fake<ISendEmail>(); var sut = new HomeController(emailSender); sut.ControllerContext = new ControllerContext(new RequestContext(A.Fake<HttpContextBase>(), new RouteData()), sut); var principal = A.Fake<IPrincipal>(); var identity = new GenericIdentity(userName); A.CallTo(() => principal.Identity).Returns(identity); A.CallTo(() => sut.ControllerContext.HttpContext.User).Returns(principal); sut.SendCustomerEmail(emailAddress); }