mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-28 03:37:45 +02:00
remove nfluent
This commit is contained in:
@@ -2,12 +2,11 @@
|
||||
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using AwesomeAssertions;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NFluent;
|
||||
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Models;
|
||||
using WireMock.ResponseBuilders;
|
||||
@@ -76,7 +75,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test http://localhost/foo /foo POSt");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test http://localhost/foo /foo POSt");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -100,7 +99,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("url=http://localhost/a/b absoluteurl=http://localhost/wiremock/a/b path=/a/b absolutepath=/wiremock/a/b");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("url=http://localhost/a/b absoluteurl=http://localhost/wiremock/a/b path=/a/b absolutepath=/wiremock/a/b");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -118,7 +117,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("a b wiremock");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("a b wiremock");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -141,7 +140,7 @@ public class ResponseWithTransformerTests
|
||||
|
||||
// Assert
|
||||
var json = (JObject)response.Message.BodyData!.BodyAsJson!;
|
||||
Check.That(json["field"]!.Value<string>()).Equals(expected);
|
||||
json["field"]!.Value<string>().Should().Be(expected);
|
||||
}
|
||||
|
||||
[Theory(Skip = "Invalid token `OpenBracket`")]
|
||||
@@ -161,7 +160,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("a wiremock");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("a wiremock");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -183,7 +182,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test keya=1,2 idx=1 idx=2 keyb=5");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test keya=1,2 idx=1 idx=2 keyb=5");
|
||||
}
|
||||
|
||||
[Theory(Skip = "Invalid token `OpenBracket`")]
|
||||
@@ -207,7 +206,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test keya=1 idx=1 idx=2 keyb=5");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test keya=1 idx=1 idx=2 keyb=5");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -230,8 +229,8 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test");
|
||||
Check.That(response.Message.StatusCode).Equals("400");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test");
|
||||
response.Message.StatusCode.Should().Be("400");
|
||||
}
|
||||
|
||||
[Theory(Skip = "WireMockList is not supported by Scriban")]
|
||||
@@ -256,8 +255,8 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test");
|
||||
Check.That(response.Message.StatusCode).Equals("400");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test");
|
||||
response.Message.StatusCode.Should().Be("400");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -282,8 +281,8 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test");
|
||||
Check.That(response.Message.StatusCode).Equals(null);
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test");
|
||||
response.Message.StatusCode.Should().Be(null);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -303,9 +302,9 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test");
|
||||
Check.That(response.Message.Headers).ContainsKey("x");
|
||||
Check.That(response.Message.Headers!["x"]).ContainsExactly("text/plain");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test");
|
||||
response.Message.Headers.Should().ContainKey("x");
|
||||
response.Message.Headers!["x"].Should().ContainSingle("text/plain");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -329,8 +328,8 @@ public class ResponseWithTransformerTests
|
||||
|
||||
// Assert
|
||||
response.Message.Headers.Should().NotBeNull();
|
||||
Check.That(response.Message.Headers).ContainsKey("x");
|
||||
Check.That(response.Message.Headers!["x"]).ContainsExactly(guid.ToString());
|
||||
response.Message.Headers.Should().ContainKey("x");
|
||||
response.Message.Headers!["x"].Should().ContainSingle(guid.ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -350,10 +349,10 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test");
|
||||
Check.That(response.Message.Headers).ContainsKey("x");
|
||||
Check.That(response.Message.Headers!["x"]).Contains("text/plain");
|
||||
Check.That(response.Message.Headers["x"]).Contains("http://localhost/foo");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test");
|
||||
response.Message.Headers.Should().ContainKey("x");
|
||||
response.Message.Headers!["x"].Should().Contain("text/plain");
|
||||
response.Message.Headers["x"].Should().Contain("http://localhost/foo");
|
||||
}
|
||||
|
||||
[Theory(Skip = "WireMockList is not supported by Scriban")]
|
||||
@@ -375,10 +374,10 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test");
|
||||
Check.That(response.Message.Headers).ContainsKey("x");
|
||||
Check.That(response.Message.Headers!["x"]).Contains("text/plain");
|
||||
Check.That(response.Message.Headers["x"]).Contains("http://localhost/foo");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test");
|
||||
response.Message.Headers.Should().ContainKey("x");
|
||||
response.Message.Headers!["x"].Should().Contain("text/plain");
|
||||
response.Message.Headers["x"].Should().Contain("http://localhost/foo");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -403,7 +402,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("test http://localhost:1234 1234 http localhost");
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("test http://localhost:1234 1234 http localhost");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -430,7 +429,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson)).Equals("{\"x\":\"test /foo_object\"}");
|
||||
JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson).Should().Be("{\"x\":\"test /foo_object\"}");
|
||||
}
|
||||
|
||||
[CulturedTheory(["en-US"])]
|
||||
@@ -577,7 +576,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson)).Equals("[\"first\",\"/foo_array\",\"test 1\",\"test 2\",\"last\"]");
|
||||
JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson).Should().Be("[\"first\",\"/foo_array\",\"test 1\",\"test 2\",\"last\"]");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -594,7 +593,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsFile).Equals(@"c:\1\test.xml");
|
||||
response.Message.BodyData!.BodyAsFile.Should().Be(@"c:\1\test.xml");
|
||||
}
|
||||
|
||||
[Theory(Skip = @"Does not work in Scriban --> c:\\[""1""]\\test.xml")]
|
||||
@@ -613,7 +612,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsFile).Equals(@"c:\1\test.xml");
|
||||
response.Message.BodyData!.BodyAsFile.Should().Be(@"c:\1\test.xml");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -637,9 +636,9 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(response.Message.BodyData!.BodyAsFile).Equals(@"c:\1\test.xml");
|
||||
Check.That(response.Message.BodyData.DetectedBodyType).Equals(BodyType.String);
|
||||
Check.That(response.Message.BodyData!.BodyAsString).Equals("<xml MyUniqueNumber=\"1\"></xml>");
|
||||
response.Message.BodyData!.BodyAsFile.Should().Be(@"c:\1\test.xml");
|
||||
response.Message.BodyData.DetectedBodyType.Should().Be(BodyType.String);
|
||||
response.Message.BodyData!.BodyAsString.Should().Be("<xml MyUniqueNumber=\"1\"></xml>");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -666,7 +665,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson)).Equals("\"test\"");
|
||||
JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson).Should().Be("\"test\"");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -712,7 +711,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson)).Equals("{\"name\":\"WireMock\"}");
|
||||
JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson).Should().Be("{\"name\":\"WireMock\"}");
|
||||
}
|
||||
|
||||
[Theory(Skip = "{{{ }}} Does not work in Scriban")]
|
||||
@@ -738,7 +737,7 @@ public class ResponseWithTransformerTests
|
||||
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, Mock.Of<HttpContext>(), request, _settings);
|
||||
|
||||
// Assert
|
||||
Check.That(JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson)).Equals("{\"name\":\"WireMock\"}");
|
||||
JsonConvert.SerializeObject(response.Message.BodyData!.BodyAsJson).Should().Be("{\"name\":\"WireMock\"}");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -847,4 +846,7 @@ AAAADElEQVR4XmMQYNgAAADkAMHebX3mAAAAAElFTkSuQmCC
|
||||
// Assert
|
||||
response.Message.BodyData!.BodyAsString.Should().Be(expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user