Skip to content
This repository has been archived by the owner on Jan 24, 2021. It is now read-only.

Commit

Permalink
Upgrade to FakeItEasy 4.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
blairconrad committed May 25, 2018
1 parent 68e0b9f commit bb34ae1
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 58 deletions.
4 changes: 2 additions & 2 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FakeItEasy" Version="4.3.0" />
<PackageReference Include="FakeItEasy.Analyzer.CSharp" Version="4.3.0" />
<PackageReference Include="FakeItEasy" Version="4.6.0" />
<PackageReference Include="FakeItEasy.Analyzer.CSharp" Version="4.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="xunit" Version="2.4.0-beta.1.build3958" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0-beta.1.build3958" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public void Should_add_a_pre_and_post_hook_in_application_when_enabled()

// Then
A.CallTo(() => pipelines.BeforeRequest.AddItemToStartOfPipeline(A<Func<NancyContext, Response>>.Ignored))
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
A.CallTo(() => pipelines.AfterRequest.AddItemToEndOfPipeline(A<Action<NancyContext>>.Ignored))
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ public void Should_add_a_pre_and_post_hook_when_enabled()
FormsAuthentication.Enable(pipelines, this.config);

A.CallTo(() => pipelines.BeforeRequest.AddItemToStartOfPipeline(A<Func<NancyContext, Response>>.Ignored))
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
A.CallTo(() => pipelines.AfterRequest.AddItemToEndOfPipeline(A<Action<NancyContext>>.Ignored))
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
}

[Fact]
Expand All @@ -131,7 +131,7 @@ public void Should_add_a_pre_hook_but_not_a_post_hook_when_DisableRedirect_is_tr
FormsAuthentication.Enable(pipelines, this.config);

A.CallTo(() => pipelines.BeforeRequest.AddItemToStartOfPipeline(A<Func<NancyContext, Response>>.Ignored))
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
A.CallTo(() => pipelines.AfterRequest.AddItemToEndOfPipeline(A<Action<NancyContext>>.Ignored))
.MustNotHaveHappened();
}
Expand Down Expand Up @@ -272,7 +272,7 @@ public void Should_encrypt_cookie_when_logging_in_with_redirect()
FormsAuthentication.UserLoggedInRedirectResponse(context, userGuid, DateTime.Now.AddDays(1));

A.CallTo(() => mockEncrypter.Encrypt(A<string>.Ignored))
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
}

[Fact]
Expand All @@ -288,7 +288,7 @@ public void Should_encrypt_cookie_when_logging_in_without_redirect()

// Then
A.CallTo(() => mockEncrypter.Encrypt(A<string>.Ignored))
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
}

[Fact]
Expand All @@ -305,7 +305,7 @@ public void Should_generate_hmac_for_cookie_from_encrypted_cookie_when_logging_i
FormsAuthentication.UserLoggedInRedirectResponse(context, userGuid, DateTime.Now.AddDays(1));

A.CallTo(() => mockHmac.GenerateHmac(fakeCryptoText))
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
}

[Fact]
Expand All @@ -325,7 +325,7 @@ public void Should_generate_hmac_for_cookie_from_encrypted_cookie_when_logging_i

// Then
A.CallTo(() => mockHmac.GenerateHmac(fakeCryptoText))
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
}

[Fact]
Expand Down Expand Up @@ -394,7 +394,7 @@ public void Should_get_username_from_mapping_service_with_valid_cookie()
fakePipelines.BeforeRequest.Invoke(this.context, new CancellationToken());

A.CallTo(() => mockMapper.GetUserFromIdentifier(this.userGuid, this.context))
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion test/Nancy.Hosting.Aspnet.Tests/NancyHandlerFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public async Task Should_dispose_the_context()
await this.handler.ProcessRequest(this.context);

// Then
A.CallTo(() => disposable.Dispose()).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => disposable.Dispose()).MustHaveHappenedOnceExactly();
}
[Fact]
public async Task Should_create_request_body_when_content_length_specified()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ public void Should_invoke_startup_tasks()
this.bootstrapper.Initialise();

// Then
A.CallTo(() => startupMock.Initialize(A<IPipelines>._)).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => startupMock2.Initialize(A<IPipelines>._)).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => startupMock.Initialize(A<IPipelines>._)).MustHaveHappenedOnceExactly();
A.CallTo(() => startupMock2.Initialize(A<IPipelines>._)).MustHaveHappenedOnceExactly();
}

[Fact]
Expand Down Expand Up @@ -214,7 +214,7 @@ public void Should_get_diagnostics_and_initialise()

this.bootstrapper.Initialise();

A.CallTo(() => fakeDiagnostics.Initialize(A<IPipelines>._)).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => fakeDiagnostics.Initialize(A<IPipelines>._)).MustHaveHappenedOnceExactly();
}

[Fact]
Expand Down Expand Up @@ -259,8 +259,8 @@ public void Should_invoke_request_startup_tasks_when_request_pipelines_initialis
uninitialiedBootstrapper.GetRequestPipelines(new NancyContext());

// Then
A.CallTo(() => startupMock.Initialize(A<IPipelines>._, A<NancyContext>._)).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => startupMock2.Initialize(A<IPipelines>._, A<NancyContext>._)).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => startupMock.Initialize(A<IPipelines>._, A<NancyContext>._)).MustHaveHappenedOnceExactly();
A.CallTo(() => startupMock2.Initialize(A<IPipelines>._, A<NancyContext>._)).MustHaveHappenedOnceExactly();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ public void Should_invoke_request_startup_tasks_when_request_pipelines_initialis
this.bootstrapper.GetRequestPipelines(new NancyContext());

// Then
A.CallTo(() => startupMock.Initialize(A<IPipelines>._, A<NancyContext>._)).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => startupMock2.Initialize(A<IPipelines>._, A<NancyContext>._)).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => startupMock.Initialize(A<IPipelines>._, A<NancyContext>._)).MustHaveHappenedOnceExactly();
A.CallTo(() => startupMock2.Initialize(A<IPipelines>._, A<NancyContext>._)).MustHaveHappenedOnceExactly();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void Should_retrieve_environment_from_factory()
this.configurator.ConfigureEnvironment(env => { });

// Then
A.CallTo(() => this.factory.CreateEnvironment()).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => this.factory.CreateEnvironment()).MustHaveHappenedOnceExactly();
}

[Fact]
Expand Down Expand Up @@ -86,7 +86,7 @@ public void Should_retrieve_default_configurations_from_default_configuration_pr
// Then
foreach (var provider in providers)
{
A.CallTo(() => provider.GetDefaultConfiguration()).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => provider.GetDefaultConfiguration()).MustHaveHappenedOnceExactly();
}
}

Expand Down
22 changes: 11 additions & 11 deletions test/Nancy.Tests/Unit/ModelBinding/DefaultBinderFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void Should_call_body_deserializer_if_one_matches()

// Then
A.CallTo(() => deserializer.Deserialize(null, null, null)).WithAnyArguments()
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
}

[Fact]
Expand Down Expand Up @@ -170,7 +170,7 @@ public void Should_pass_request_content_type_to_can_deserialize()

// Then
A.CallTo(() => deserializer.CanDeserialize(A<MediaRange>.That.Matches(x => x.Matches("application/xml")), A<BindingContext>._))
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
}

[Fact]
Expand All @@ -187,7 +187,7 @@ public void Should_pass_binding_context_to_can_deserialize()

// Then
A.CallTo(() => deserializer.CanDeserialize(A<MediaRange>.That.Matches(x => x.Matches("application/xml")), A<BindingContext>.That.Not.IsNull()))
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
}

[Fact]
Expand Down Expand Up @@ -273,7 +273,7 @@ public void Should_see_if_a_type_converter_is_available_for_each_property_on_the

// Then
A.CallTo(() => typeConverter.CanConvertTo(null, null)).WithAnyArguments()
.MustHaveHappened(Repeated.Exactly.Times(2));
.MustHaveHappenedTwiceExactly();
}

[Fact]
Expand All @@ -292,7 +292,7 @@ public void Should_call_convert_on_type_converter_if_available()

// Then
A.CallTo(() => typeConverter.Convert(null, null, null)).WithAnyArguments()
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
}

[Fact]
Expand Down Expand Up @@ -414,7 +414,7 @@ public void Should_pass_binding_context_to_default_deserializer()

// Then
A.CallTo(() => deserializer.CanDeserialize(A<MediaRange>.That.Matches(x => x.Matches("application/xml")), A<BindingContext>.That.Not.IsNull()))
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
}

[Fact]
Expand All @@ -431,7 +431,7 @@ public void Should_use_field_name_converter_for_each_field()

// Then
A.CallTo(() => this.passthroughNameConverter.Convert(null)).WithAnyArguments()
.MustHaveHappened(Repeated.Exactly.Times(2));
.MustHaveHappenedTwiceExactly();
}

[Fact]
Expand Down Expand Up @@ -490,7 +490,7 @@ public void Should_use_default_body_deserializer_if_one_found()

// Then
A.CallTo(() => deserializer.Deserialize(null, null, null)).WithAnyArguments()
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
}

[Fact]
Expand All @@ -510,7 +510,7 @@ public void Should_use_default_type_converter_if_one_found()

// Then
A.CallTo(() => typeConverter.Convert(null, null, null)).WithAnyArguments()
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
}

[Fact]
Expand All @@ -533,7 +533,7 @@ public void User_body_serializer_should_take_precedence_over_default_one()

// Then
A.CallTo(() => userDeserializer.Deserialize(null, null, null)).WithAnyArguments()
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
A.CallTo(() => defaultDeserializer.Deserialize(null, null, null)).WithAnyArguments()
.MustNotHaveHappened();
}
Expand All @@ -558,7 +558,7 @@ public void User_type_converter_should_take_precedence_over_default_one()

// Then
A.CallTo(() => userTypeConverter.Convert(null, null, null)).WithAnyArguments()
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
A.CallTo(() => defaultTypeConverter.Convert(null, null, null)).WithAnyArguments()
.MustNotHaveHappened();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void Array_type_conversion_should_use_type_converter()
converter.Convert(input, typeof(string[]), mockContext);

A.CallTo(() => this.mockStringTypeConverter.Convert(null, null, null)).WithAnyArguments()
.MustHaveHappened(Repeated.Exactly.Times(3));
.MustHaveHappened(3, Times.Exactly);
}

[Fact]
Expand All @@ -72,7 +72,7 @@ public void Collection_type_conversion_should_use_type_converter()
converter.Convert(input, typeof(List<string>), mockContext);

A.CallTo(() => this.mockStringTypeConverter.Convert(null, null, null)).WithAnyArguments()
.MustHaveHappened(Repeated.Exactly.Times(3));
.MustHaveHappened(3, Times.Exactly);
}

[Fact]
Expand All @@ -95,7 +95,7 @@ public void IEnumerable_type_conversion_should_use_type_converter()
converter.Convert(input, typeof(IEnumerable<string>), mockContext);

A.CallTo(() => this.mockStringTypeConverter.Convert(null, null, null)).WithAnyArguments()
.MustHaveHappened(Repeated.Exactly.Times(3));
.MustHaveHappened(3, Times.Exactly);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void Should_pass_type_to_locator_when_cast_implicitly()
Model result = adapter;

// Then
A.CallTo(() => fakeLocator.GetBinderForType(typeof(Model), A<NancyContext>.Ignored)).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => fakeLocator.GetBinderForType(typeof(Model), A<NancyContext>.Ignored)).MustHaveHappenedOnceExactly();
}

[Fact]
Expand All @@ -77,7 +77,7 @@ public void Should_invoke_binder_with_context()
Model result = adapter;

// Then
A.CallTo(() => fakeLocator.GetBinderForType(A<Type>.Ignored, context)).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => fakeLocator.GetBinderForType(A<Type>.Ignored, context)).MustHaveHappenedOnceExactly();
}

[Fact]
Expand All @@ -96,7 +96,7 @@ public void Should_pass_type_to_locator_when_cast_explicitly()
var result = (Model)adapter;

// Then
A.CallTo(() => fakeLocator.GetBinderForType(typeof(Model), A<NancyContext>.Ignored)).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => fakeLocator.GetBinderForType(typeof(Model), A<NancyContext>.Ignored)).MustHaveHappenedOnceExactly();
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion test/Nancy.Tests/Unit/NancyContextFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void Should_dispose_disposable_items_when_disposed()
this.context.Dispose();

// Then
A.CallTo(() => disposable.Dispose()).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => disposable.Dispose()).MustHaveHappenedOnceExactly();
}

[Fact]
Expand Down
6 changes: 3 additions & 3 deletions test/Nancy.Tests/Unit/NancyEngineFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public void HandleRequest_should_get_context_from_context_factory()
this.engine.HandleRequest(request);

// Then
A.CallTo(() => this.contextFactory.Create(request)).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => this.contextFactory.Create(request)).MustHaveHappenedOnceExactly();
}

[Fact]
Expand Down Expand Up @@ -309,7 +309,7 @@ public async Task Should_ask_status_handler_if_it_can_handle_status_code()
await this.engine.HandleRequest(request);

// Then
A.CallTo(() => this.statusCodeHandler.HandlesStatusCode(A<HttpStatusCode>.Ignored, A<NancyContext>.Ignored)).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => this.statusCodeHandler.HandlesStatusCode(A<HttpStatusCode>.Ignored, A<NancyContext>.Ignored)).MustHaveHappenedOnceExactly();
}

[Fact]
Expand All @@ -336,7 +336,7 @@ public async Task Should_invoke_status_handler_if_supported_status_code()
await this.engine.HandleRequest(request);

// Then
A.CallTo(() => this.statusCodeHandler.Handle(A<HttpStatusCode>.Ignored, A<NancyContext>.Ignored)).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => this.statusCodeHandler.Handle(A<HttpStatusCode>.Ignored, A<NancyContext>.Ignored)).MustHaveHappenedOnceExactly();
}

[Fact]
Expand Down
4 changes: 2 additions & 2 deletions test/Nancy.Tests/Unit/NancyMiddlewareFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void Should_immediately_invoke_nancy_if_no_request_body_delegate()
A<Request>.Ignored,
A<Func<NancyContext, NancyContext>>.Ignored,
(CancellationToken)this.environment["owin.CallCancelled"]))
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappenedOnceExactly();
}

[Fact]
Expand Down Expand Up @@ -155,7 +155,7 @@ public void Should_dispose_context_on_completion_of_body_delegate()
this.host.Invoke(environment);

// Then
A.CallTo(() => mockDisposable.Dispose()).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => mockDisposable.Dispose()).MustHaveHappenedOnceExactly();
}

[Fact]
Expand Down
Loading

0 comments on commit bb34ae1

Please sign in to comment.