mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-10 03:13:53 +02:00
xunit v3
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
//#if PROTOBUF
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
using WireMock.Util;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Grpc;
|
||||
|
||||
@@ -24,11 +19,11 @@ public class ProtoBufUtilsTests
|
||||
// Act
|
||||
var responseBytes = await ProtoBufUtils.GetProtoBufMessageWithHeaderAsync(
|
||||
[greet, request],
|
||||
"greet.HelloRequest",
|
||||
new
|
||||
"greet.HelloRequest", new
|
||||
{
|
||||
name = "hello"
|
||||
}
|
||||
},
|
||||
cancellationToken: TestContext.Current.CancellationToken
|
||||
);
|
||||
|
||||
// Assert
|
||||
@@ -39,5 +34,4 @@ public class ProtoBufUtilsTests
|
||||
{
|
||||
return File.ReadAllText(Path.Combine(Directory.GetCurrentDirectory(), "Grpc", filename));
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
@@ -1,12 +1,7 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
//#if PROTOBUF
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
using WireMock.Util;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Grpc;
|
||||
|
||||
@@ -65,11 +60,11 @@ public class ProtoDefinitionHelperTests
|
||||
{
|
||||
rejected_spans = 1,
|
||||
error_message = "abc"
|
||||
}
|
||||
},
|
||||
cancellationToken: TestContext.Current.CancellationToken
|
||||
);
|
||||
|
||||
// Assert
|
||||
Convert.ToBase64String(responseBytes).Should().Be("AAAAAAcIARIDYWJj");
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
@@ -1,18 +1,14 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
//#if PROTOBUF
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ExampleIntegrationTest.Lookup;
|
||||
using FluentAssertions;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
using Greet;
|
||||
using Grpc.Net.Client;
|
||||
using ExampleIntegrationTest.Lookup;
|
||||
using WireMock.Constants;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.RequestBuilders;
|
||||
@@ -20,7 +16,6 @@ using WireMock.ResponseBuilders;
|
||||
using WireMock.Server;
|
||||
using WireMock.Settings;
|
||||
using WireMock.Util;
|
||||
using Xunit;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace WireMock.Net.Tests;
|
||||
@@ -140,7 +135,7 @@ message Other {
|
||||
protoBuf.Headers.ContentType = new MediaTypeHeaderValue("application/grpc-web");
|
||||
|
||||
var client = server.CreateClient();
|
||||
var response = await client.PostAsync("/grpc/greet.Greeter/SayHello", protoBuf);
|
||||
var response = await client.PostAsync("/grpc/greet.Greeter/SayHello", protoBuf, TestContext.Current.CancellationToken);
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||
@@ -178,7 +173,7 @@ message Other {
|
||||
protoBuf.Headers.ContentType = new MediaTypeHeaderValue("application/grpc-web");
|
||||
|
||||
var client = server.CreateClient();
|
||||
var response = await client.PostAsync("/grpc/greet.Greeter/SayHello", protoBuf);
|
||||
var response = await client.PostAsync("/grpc/greet.Greeter/SayHello", protoBuf, TestContext.Current.CancellationToken);
|
||||
|
||||
// Assert
|
||||
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||
@@ -772,5 +767,4 @@ message Other {
|
||||
{
|
||||
return File.ReadAllText(Path.Combine(Directory.GetCurrentDirectory(), "Grpc", filename));
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
Reference in New Issue
Block a user