public async Task LoadMap_StateUnderTest_ExpectedBehavior(string uri, string resultFacetCode, string specificationKey, string viewType) { // Arrange var payload = FakeLoadResultPayload(uri, resultFacetCode, specificationKey, viewType); // Act /* using */ var response = await Fixture.Client.PostAsync("api/result/load", payload); // Assert response.EnsureSuccessStatusCode(); var responseContent = await response.Content.ReadAsStringAsync(); var result = JsonConvert.DeserializeObject <ResultContentSet>(responseContent); Assert.NotNull(result); Assert.NotNull(result.Data); Assert.NotNull(result.Data.DataCollection); Assert.NotNull(result.Meta); Assert.NotNull(result.Meta.Columns); Assert.True(result.Meta.Columns.Any()); Assert.NotEmpty(result.Query); var sqlQuery = result.Query.Squeeze(); var matcher = new MapResultSqlCompilerMatcher(); var match = matcher.Match(sqlQuery); Assert.True(match.Success); }
public void Compile_DomainFacetsWithSingleChildFacet_HasExpectedSqlQuery(string uri, string resultFacetCode, string specificationKey, string _) { // Arrange var fakeFacetsConfig = FakeFacetsConfig(uri); var fakeQuerySetup = FakeResultQuerySetup(fakeFacetsConfig, resultFacetCode, specificationKey); var fakeResultFields = FakeResultConfig(resultFacetCode, specificationKey, "map").GetSortedFields(); // Act var sqlCompiler = new MapResultSqlCompiler(); var result = sqlCompiler.Compile(fakeQuerySetup, fakeQuerySetup.Facet, fakeResultFields); // Assert var matcher = new MapResultSqlCompilerMatcher(); var match = matcher.Match(result); Assert.True(match.Success); }
public void Compile_StateUnderTest_ExpectedBehavior(string uri, string resultFacetCode, string specificationKey) { // Arrange var fakeFacetsConfig = FakeFacetsConfig(uri); var fakeQuerySetup = FakeResultQuerySetup(fakeFacetsConfig, resultFacetCode, specificationKey); var fakeResultFields = FakeResultConfig(resultFacetCode, specificationKey, "map").GetSortedFields(); // Act var sqlCompiler = new MapResultSqlCompiler(); var result = sqlCompiler.Compile(fakeQuerySetup, fakeQuerySetup.Facet, fakeResultFields); // Assert var matcher = new MapResultSqlCompilerMatcher(); var match = matcher.Match(result); Assert.True(match.Success); }