Files
WireMock.Net/test/WireMock.Net.Tests/RequestBuilders/RequestBuilderUsingMethodTests.cs
Stef Heyenrath f358f13c08 Solved issues #204 #205 #200
* Lower priority from Proxy mappings

* Fix codefactor

* extra tests

* #205

* Fix test for linux

* `c:\temp\x.json` fix

* Extra tests

* more tests

* more tests

* codefactor

* #200

* refactor

* refactor

* tests
2018-09-22 08:41:24 +02:00

33 lines
1022 B
C#

using System.Collections.Generic;
using NFluent;
using WireMock.Matchers;
using WireMock.Matchers.Request;
using WireMock.Models;
using WireMock.RequestBuilders;
using WireMock.Util;
using Xunit;
namespace WireMock.Net.Tests
{
public class RequestBuilderUsingMethodTests
{
[Fact]
public void RequestBuilder_UsingAnyMethod_ClearsAllOtherMatches()
{
// Assign
var requestBuilder = (Request)Request.Create().UsingGet();
// Assert 1
var matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
Check.That(matchers.Count()).IsEqualTo(1);
Check.That(matchers[0]).IsInstanceOfType(typeof(RequestMessageMethodMatcher));
// Act
requestBuilder.UsingAnyMethod();
// Assert 2
matchers = requestBuilder.GetPrivateFieldValue<IList<IRequestMatcher>>("_requestMatchers");
Check.That(matchers.Count()).IsEqualTo(0);
}
}
}