public async Task LibraryApi_CompareCurrentApiMetadataToPriorRun() { var fileName = $"{Path.Combine(relativePath, baselineFolder)}{typeof(LibraryApi).Name}-ApiMetadata.txt"; File.Exists(fileName).Should().BeTrue(); var oldReport = File.ReadAllText(fileName); var newReport = await RestierTestHelpers.GetApiMetadataAsync <LibraryApi, LibraryContext>(); oldReport.Should().BeEquivalentTo(newReport.ToString()); }
public async Task StoreApi_CompareCurrentApiMetadataToPriorRun() { var fileName = $"{Path.Combine(relativePath, baselineFolder)}{typeof(StoreApi).Name}-ApiMetadata.txt"; File.Exists(fileName).Should().BeTrue(); var oldReport = File.ReadAllText(fileName); var newReport = await RestierTestHelpers.GetApiMetadataAsync <StoreApi, DbContext>(serviceCollection : (services) => { services.AddTestStoreApiServices(); }); oldReport.Should().BeEquivalentTo(newReport.ToString()); }
public async Task BoundFunctions_WithParameter_Returns200() { var metadata = RestierTestHelpers.GetApiMetadataAsync <LibraryApi, LibraryContext>(); var payload = new { bookId = new Guid("2D760F15-974D-4556-8CDF-D610128B537E") }; var response = await RestierTestHelpers.ExecuteTestRequest <LibraryApi, LibraryContext>(HttpMethod.Post, resource : "/Publishers('Publisher1')/PublishNewBook()", payload : payload, acceptHeader : WebApiConstants.DefaultAcceptHeader); var content = await TestContext.LogAndReturnMessageContentAsync(response); response.IsSuccessStatusCode.Should().BeTrue(); response.StatusCode.Should().Be(HttpStatusCode.OK); var results = JsonConvert.DeserializeObject <Publisher>(content); results.Should().NotBeNull(); results.Books.All(c => c.Title == "Sea of Rust").Should().BeTrue(); }