public void GetLinks_Non_Emtpy_Collection_Should_Return_Single_Document() { // Arrange var docs = Fixture.CreateMany <LinkBundle>(1); // Act IActionResult result = LinkOperations.GetLinks(this.DefaultRequest, docs, string.Empty, A.Dummy <ILogger>()); // Assert Assert.IsType <OkObjectResult>(result); Assert.Equal(docs.Single(), (result as OkObjectResult).Value); }
public void GetLinks_Emtpy_Collection_Should_Return_NotFound() { // Arrange IEnumerable <LinkBundle> docs = Enumerable.Empty <LinkBundle>(); ILogger fakeLogger = A.Fake <ILogger>(); // Act IActionResult result = LinkOperations.GetLinks(this.DefaultRequest, docs, "vanityUrl", fakeLogger); // Assert Assert.IsType <NotFoundResult>(result); A.CallTo(fakeLogger) .Where(call => call.Method.Name == "Log" && call.GetArgument <LogLevel>("logLevel") == LogLevel.Information) .MustHaveHappened(); }