public void OutputWriterResult_WritesBack() { var controller = new RootController(); controller.Index().Should().BeOfType <OutputWriterResult>(); var req = WebRequest.CreateDefault(new Uri(BuildUrl("/"))); var reply = (HttpWebResponse)req.GetResponse(); reply.StatusCode.Should().Be(HttpStatusCode.OK); reply.ContentType.Should().Be("text/html"); new StreamReader(reply.GetResponseStream()).ReadToEnd().Should().Be("Howdy"); }
public async void GetUsersReturnsViewResultListOrItemOrNotFound() { var id = new Guid("2d65fadd-cdfc-4a67-9e85-2b200bd269da"); //var id = Guid.Empty; _mock.Setup(repo => repo.GetUsers(id)).Returns(_repo.GetTestUsers(id)); var controller = new RootController(_mock.Object); var result = await controller.Index(id); var viewResult = Assert.IsType <ViewResult>(result); Assert.NotNull(viewResult.Model); Assert.Equal(viewResult.Model.ToString().GetHashCode(), _repo.GetTestUsers(id).ToString().GetHashCode()); }
public void Index_Displays_Index() { var result = controller.Index(); Assert.IsNotNull(result); }