Skip to content

Commit

Permalink
Renamed package
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkagamine committed Apr 13, 2019
1 parent 8b04f3a commit 644bca7
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ language: csharp
mono: none
dotnet: 2.1.500
script:
- dotnet test test/MaxKagamine.Moq.HttpClient.Test
- dotnet test test/Moq.Contrib.HttpClient.Test
4 changes: 2 additions & 2 deletions MaxKagamine.Moq.HttpClient.sln → Moq.Contrib.HttpClient.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C40CC895-DEA
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{8AD2CDD5-EF40-4EA0-BD3A-98A074EF09B3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MaxKagamine.Moq.HttpClient", "src\MaxKagamine.Moq.HttpClient\MaxKagamine.Moq.HttpClient.csproj", "{12F6B27E-0A30-4105-80FF-B5C9B5D69C6B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moq.Contrib.HttpClient", "src\Moq.Contrib.HttpClient\Moq.Contrib.HttpClient.csproj", "{12F6B27E-0A30-4105-80FF-B5C9B5D69C6B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaxKagamine.Moq.HttpClient.Test", "test\MaxKagamine.Moq.HttpClient.Test\MaxKagamine.Moq.HttpClient.Test.csproj", "{68DA515D-A6F6-4C6B-A750-8456498868A0}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Moq.Contrib.HttpClient.Test", "test\Moq.Contrib.HttpClient.Test\Moq.Contrib.HttpClient.Test.csproj", "{68DA515D-A6F6-4C6B-A750-8456498868A0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
18 changes: 9 additions & 9 deletions README.ja.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Moq.HttpClient
# Moq.Contrib.HttpClient

[![NuGet](https://img.shields.io/nuget/v/MaxKagamine.Moq.HttpClient.svg)](https://www.nuget.org/packages/MaxKagamine.Moq.HttpClient/) [![Travis](https://img.shields.io/travis/com/maxkagamine/Moq.HttpClient.svg)](https://travis-ci.com/maxkagamine/Moq.HttpClient)
[![NuGet](https://img.shields.io/nuget/v/Moq.Contrib.HttpClient.svg)](https://www.nuget.org/packages/Moq.Contrib.HttpClient/) [![Travis](https://img.shields.io/travis/com/maxkagamine/Moq.Contrib.HttpClient.svg)](https://travis-ci.com/maxkagamine/Moq.Contrib.HttpClient)

[ブログ投稿](https://maxkagamine.jp/blog/moq-de-httpclient-to-ihttpclientfactory-o-mokkusuru-kantanna-houhou)  ·  [English](README.md)

Expand All @@ -23,9 +23,9 @@ HttpClientを直にモックすることが難しいのは[よく知られてい

## インストール

`Install-Package MaxKagamine.Moq.HttpClient`
`Install-Package Moq.Contrib.HttpClient`

または `dotnet add package MaxKagamine.Moq.HttpClient`
または `dotnet add package Moq.Contrib.HttpClient`

## API

Expand Down Expand Up @@ -113,7 +113,7 @@ handler.SetupRequest(r => ((Url) r.RequestUri).QueryParams["hoge"].Equals("piyo"
.ReturnsResponse("stuff");
```

最後の例えはクエリ文字列をチェックするのを手伝うために[Flurl](https://flurl.io/docs/fluent-url/)というフルーエントURLビルダーを使います。これはURLを作るも簡単にすることができます、例えば精密なURLとクエリ文字列をマッチしたかった。用例は[リクエスト拡張のテスト](test/MaxKagamine.Moq.HttpClient.Test/RequestExtensionsTests.cs)を見てください
最後の例えはクエリ文字列をチェックするのを手伝うために[Flurl](https://flurl.io/docs/fluent-url/)というフルーエントURLビルダーを使います。これはURLを作るも簡単にすることができます、例えば精密なURLとクエリ文字列をマッチしたかった。用例は[リクエスト拡張のテスト](test/Moq.Contrib.HttpClient.Test/RequestExtensionsTests.cs)を見てください

### リクエストのシークエンスをセットアップする

Expand All @@ -124,7 +124,7 @@ Moqは2つシークエンスのタイプがあります:

互いに独立しているリクエストが特定の順序にマッチするの必要がある場合は後者が便利です。セットアップは一方が他方の前に必ずマッチするためにシークエンスで定義される。これはレスポンスをキューに入れることによって動作する他のライブラリと似ています

両方の用例は[シークエンス拡張のテスト](test/MaxKagamine.Moq.HttpClient.Test/SequenceExtensionsTests.cs)を見てください
両方の用例は[シークエンス拡張のテスト](test/Moq.Contrib.HttpClient.Test/SequenceExtensionsTests.cs)を見てください

### リクエストの本体に基づいてレスポンスを書く

Expand Down Expand Up @@ -170,9 +170,9 @@ Mock.Get(factory).Setup(x => x.CreateClient("api"))

文書化としてユニットテストに向けるのが過ちかもしれないけど、この場合はこのライブラリがテストのためだしテストがこれを念頭に置いて書かれたから、もっと完全な用例(コメントと)は、こちら見てください:

- **[リクエスト拡張のテスト](test/MaxKagamine.Moq.HttpClient.Test/RequestExtensionsTests.cs)** — これらはSetupとVerifyのヘルパーのみを使います
- **[レスポンス拡張のテスト](test/MaxKagamine.Moq.HttpClient.Test/ResponseExtensionsTests.cs)** — これらはReturnsResponseヘルパーに焦点をあてます
- **[シークエンス拡張のテスト](test/MaxKagamine.Moq.HttpClient.Test/SequenceExtensionsTests.cs)** — これらはシークエンスをモックすることを実証します
- **[リクエスト拡張のテスト](test/Moq.Contrib.HttpClient.Test/RequestExtensionsTests.cs)** — これらはSetupとVerifyのヘルパーのみを使います
- **[レスポンス拡張のテスト](test/Moq.Contrib.HttpClient.Test/ResponseExtensionsTests.cs)** — これらはReturnsResponseヘルパーに焦点をあてます
- **[シークエンス拡張のテスト](test/Moq.Contrib.HttpClient.Test/SequenceExtensionsTests.cs)** — これらはシークエンスをモックすることを実証します

## ライセンス / 寄付

Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Moq.HttpClient
# Moq.Contrib.HttpClient

[![NuGet](https://img.shields.io/nuget/v/MaxKagamine.Moq.HttpClient.svg)](https://www.nuget.org/packages/MaxKagamine.Moq.HttpClient/) [![Travis](https://img.shields.io/travis/com/maxkagamine/Moq.HttpClient.svg)](https://travis-ci.com/maxkagamine/Moq.HttpClient)
[![NuGet](https://img.shields.io/nuget/v/Moq.Contrib.HttpClient.svg)](https://www.nuget.org/packages/Moq.Contrib.HttpClient/) [![Travis](https://img.shields.io/travis/com/maxkagamine/Moq.Contrib.HttpClient.svg)](https://travis-ci.com/maxkagamine/Moq.Contrib.HttpClient)

[Blog post](https://maxkagamine.com/blog/mocking-httpclient-ihttpclientfactory-with-moq-the-easy-way)  ·  [日本語](README.ja.md)

Expand All @@ -23,9 +23,9 @@ Mocking HttpClient directly is [notoriously difficult](https://github.com/dotnet

## Install

`Install-Package MaxKagamine.Moq.HttpClient`
`Install-Package Moq.Contrib.HttpClient`

or `dotnet add package MaxKagamine.Moq.HttpClient`
or `dotnet add package Moq.Contrib.HttpClient`

## API

Expand Down Expand Up @@ -113,7 +113,7 @@ handler.SetupRequest(r => ((Url) r.RequestUri).QueryParams["foo"].Equals("bar"))
.ReturnsResponse("stuff");
```

The last example uses [Flurl](https://flurl.io/docs/fluent-url/), a fluent URL builder, to assist in checking the query string. This can also make constructing a URL easier, for instance if we wanted to match an exact URL and query string. See the [request extensions tests](test/MaxKagamine.Moq.HttpClient.Test/RequestExtensionsTests.cs) for an example.
The last example uses [Flurl](https://flurl.io/docs/fluent-url/), a fluent URL builder, to assist in checking the query string. This can also make constructing a URL easier, for instance if we wanted to match an exact URL and query string. See the [request extensions tests](test/Moq.Contrib.HttpClient.Test/RequestExtensionsTests.cs) for an example.

### Setting up a sequence of requests

Expand All @@ -124,7 +124,7 @@ Moq has two types of sequences:

The latter can be useful for cases where separate requests independent of each other must be made in a certain order; their setups can be defined in a sequence such that one must match before the other. This is similar to other testing libraries that work by queueing responses.

See the [sequence extensions tests](test/MaxKagamine.Moq.HttpClient.Test/SequenceExtensionsTests.cs) for examples of each.
See the [sequence extensions tests](test/Moq.Contrib.HttpClient.Test/SequenceExtensionsTests.cs) for examples of each.

### Composing responses based on the request body

Expand Down Expand Up @@ -170,9 +170,9 @@ The factory can then be passed into the class or [injected via AutoMocker](https

Though it may be a faux pas to point to the unit tests as documentation, in this case the library is specifically for testing, and so they were written with this in mind. Thus, for some more complete working examples (with comments), please see here:

- **[Request extensions tests](test/MaxKagamine.Moq.HttpClient.Test/RequestExtensionsTests.cs)** — these strictly cover the Setup & Verify helpers
- **[Response extensions tests](test/MaxKagamine.Moq.HttpClient.Test/ResponseExtensionsTests.cs)** — these focus on the ReturnsResponse helpers
- **[Sequence extensions tests](test/MaxKagamine.Moq.HttpClient.Test/SequenceExtensionsTests.cs)** — these demonstrate mocking sequences, as mentioned above
- **[Request extensions tests](test/Moq.Contrib.HttpClient.Test/RequestExtensionsTests.cs)** — these strictly cover the Setup & Verify helpers
- **[Response extensions tests](test/Moq.Contrib.HttpClient.Test/ResponseExtensionsTests.cs)** — these focus on the ReturnsResponse helpers
- **[Sequence extensions tests](test/Moq.Contrib.HttpClient.Test/SequenceExtensionsTests.cs)** — these demonstrate mocking sequences, as mentioned above

## License / Donate

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Threading;
using System.Threading.Tasks;

namespace MaxKagamine.Moq.HttpClient
namespace Moq.Contrib.HttpClient
{
/// <summary>
/// An interface to facilitate mocking the protected <see cref="HttpMessageHandler.SendAsync(HttpRequestMessage, CancellationToken)" /> method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Moq.Language.Flow;
using Moq.Protected;

namespace MaxKagamine.Moq.HttpClient
namespace Moq.Contrib.HttpClient
{
using System.Net.Http;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<Authors>Max Kagamine</Authors>
<Copyright>Copyright © 2018 Max Kagamine</Copyright>
<Description>A set of extension methods for mocking HttpClient and IHttpClientFactory with Moq.</Description>
<PackageLicenseUrl>https://github.com/maxkagamine/Moq.HttpClient/blob/master/LICENSE.txt</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/maxkagamine/Moq.HttpClient</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/maxkagamine/Moq.Contrib.HttpClient/blob/master/LICENSE.txt</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/maxkagamine/Moq.Contrib.HttpClient</PackageProjectUrl>
<PackageTags>moq http httpclient mock mocking test testing</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/maxkagamine/Moq.HttpClient</RepositoryUrl>
<RepositoryUrl>https://github.com/maxkagamine/Moq.Contrib.HttpClient</RepositoryUrl>
<Version>1.1.0</Version>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
using Moq.Language;
using Moq.Language.Flow;

namespace MaxKagamine.Moq.HttpClient
namespace Moq.Contrib.HttpClient
{
public static partial class MockHttpMessageHandlerExtensions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ using Moq;
using Moq.Language;
using Moq.Language.Flow;

namespace MaxKagamine.Moq.HttpClient
namespace Moq.Contrib.HttpClient
{
public static partial class MockHttpMessageHandlerExtensions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Threading.Tasks;
using Moq;

namespace MaxKagamine.Moq.HttpClient
namespace Moq.Contrib.HttpClient
{
/// <summary>
/// Custom Moq matchers for <see cref="HttpRequestMessage" /> using <see cref="Match.Create{T}(Predicate{T})" />.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Moq.Language;
using Moq.Language.Flow;

namespace MaxKagamine.Moq.HttpClient
namespace Moq.Contrib.HttpClient
{
public static partial class MockHttpMessageHandlerExtensions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Moq;
using Xunit;

namespace MaxKagamine.Moq.HttpClient.Test
namespace Moq.Contrib.HttpClient.Test
{
public class CreateClientFactoryExtensionTests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\MaxKagamine.Moq.HttpClient\MaxKagamine.Moq.HttpClient.csproj" />
<ProjectReference Include="..\..\src\Moq.Contrib.HttpClient\Moq.Contrib.HttpClient.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using Newtonsoft.Json.Serialization;
using Xunit;

namespace MaxKagamine.Moq.HttpClient.Test
namespace Moq.Contrib.HttpClient.Test
{
public class RequestExtensionsTests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using Moq;
using Xunit;

namespace MaxKagamine.Moq.HttpClient.Test
namespace Moq.Contrib.HttpClient.Test
{
public class ResponseExtensionsTests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Polly;
using Xunit;

namespace MaxKagamine.Moq.HttpClient.Test
namespace Moq.Contrib.HttpClient.Test
{
public class SequenceExtensionsTests
{
Expand Down

0 comments on commit 644bca7

Please sign in to comment.