mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-26 03:11:56 +01:00
Add GraphQL Schema matching (#964)
* Add GrapQLMatcher * tests * x * . * . * RequestMessageGraphQLMatcher * . * more tests * tests * ... * ms * . * more tests * GraphQL.NET !!! * . * executionResult * nw * sonarcloud
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
{
|
||||
Guid: Guid_1,
|
||||
UpdatedAt: DateTime_1,
|
||||
Title: ,
|
||||
Description: ,
|
||||
Priority: 42,
|
||||
Request: {
|
||||
Body: {
|
||||
Matcher: {
|
||||
Name: GraphQLMatcher,
|
||||
Pattern:
|
||||
type Query {
|
||||
greeting:String
|
||||
students:[Student]
|
||||
studentById(id:ID!):Student
|
||||
}
|
||||
|
||||
type Student {
|
||||
id:ID!
|
||||
firstName:String
|
||||
lastName:String
|
||||
fullName:String
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
Response: {},
|
||||
UseWebhooksFireAndForget: false
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
Guid: Guid_1,
|
||||
UpdatedAt: DateTime_1,
|
||||
Title: ,
|
||||
Description: ,
|
||||
Priority: 42,
|
||||
Request: {
|
||||
Path: {
|
||||
Matchers: [
|
||||
{
|
||||
Name: WildcardMatcher,
|
||||
Pattern: 1.2.3.4,
|
||||
IgnoreCase: false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
Response: {},
|
||||
UseWebhooksFireAndForget: false
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -260,7 +260,7 @@ public partial class MappingConverterTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public Task ToMappingModel_WithDelayAsMilliSeconds_ReturnsCorrectModel()
|
||||
public Task ToMappingModel_WithDelay_ReturnsCorrectModel()
|
||||
{
|
||||
// Assign
|
||||
var delay = 1000;
|
||||
@@ -343,5 +343,56 @@ public partial class MappingConverterTests
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public Task ToMappingModel_Request_WithClientIP_ReturnsCorrectModel()
|
||||
{
|
||||
// Arrange
|
||||
var request = Request.Create().WithClientIP("1.2.3.4");
|
||||
var response = Response.Create();
|
||||
var mapping = new Mapping(_guid, _updatedAt, string.Empty, string.Empty, null, _settings, request, response, 42, null, null, null, null, null, false, null, null, null);
|
||||
|
||||
// Act
|
||||
var model = _sut.ToMappingModel(mapping);
|
||||
|
||||
// Assert
|
||||
model.Should().NotBeNull();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
}
|
||||
|
||||
#if GRAPHQL
|
||||
[Fact]
|
||||
public Task ToMappingModel_Request_WithBodyAsGraphQLSchema_ReturnsCorrectModel()
|
||||
{
|
||||
// Arrange
|
||||
var schema = @"
|
||||
type Query {
|
||||
greeting:String
|
||||
students:[Student]
|
||||
studentById(id:ID!):Student
|
||||
}
|
||||
|
||||
type Student {
|
||||
id:ID!
|
||||
firstName:String
|
||||
lastName:String
|
||||
fullName:String
|
||||
}";
|
||||
var request = Request.Create().WithBodyAsGraphQLSchema(schema);
|
||||
var response = Response.Create();
|
||||
var mapping = new Mapping(_guid, _updatedAt, string.Empty, string.Empty, null, _settings, request, response, 42, null, null, null, null, null, false, null, null, null);
|
||||
|
||||
// Act
|
||||
var model = _sut.ToMappingModel(mapping);
|
||||
|
||||
// Assert
|
||||
model.Should().NotBeNull();
|
||||
|
||||
// Verify
|
||||
return Verifier.Verify(model);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user