Skip to content

Commit 3a0683e

Browse files
committed
Moved all plugins into Plugins namespace (closes #151)
1 parent 2d13454 commit 3a0683e

File tree

35 files changed

+87
-111
lines changed

35 files changed

+87
-111
lines changed

samples/MusicStore/MusicStore.Test/Controllers/AccountControllerTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void PostLoginShouldHaveCorrectActionFilters()
5454
MyMvc
5555
.Controller<AccountController>()
5656
.Calling(c => c.Login(
57-
new LoginViewModel { Email = "Test", Password = "Test" },
57+
With.Default<LoginViewModel>(),
5858
With.No<string>()))
5959
.ShouldHave()
6060
.ActionAttributes(attrs => attrs

samples/MusicStore/MusicStore.Test/Controllers/ShoppingCartControllerTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public void RemoveFromCartShouldRemoveItemFromCart()
119119
.Calling(c => c.RemoveFromCart(cartItemId, CancellationToken.None))
120120
.ShouldReturn()
121121
.Json()
122-
.WithResponseModelOfType<ShoppingCartRemoveViewModel>()
122+
.WithModelOfType<ShoppingCartRemoveViewModel>()
123123
.Passing(model =>
124124
{
125125
Assert.Equal(numberOfItem - 1, model.CartCount);

samples/MusicStore/MusicStore.Test/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,7 @@
22
using System.Runtime.InteropServices;
33
using Xunit;
44

5-
[assembly: CollectionBehavior(MaxParallelThreads = -1)]
6-
7-
// General Information about an assembly is controlled through the following
8-
// set of attributes. Change these attribute values to modify the information
9-
// associated with an assembly.
10-
[assembly: AssemblyConfiguration("")]
11-
[assembly: AssemblyCompany("")]
125
[assembly: AssemblyProduct("MusicStore.Test")]
13-
[assembly: AssemblyTrademark("")]
14-
15-
// Setting ComVisible to false makes the types in this assembly not visible
16-
// to COM components. If you need to access a type in this assembly from
17-
// COM, set the ComVisible attribute to true on that type.
186
[assembly: ComVisible(false)]
197

20-
// The following GUID is for the ID of the typelib if this project is exposed to COM
21-
[assembly: Guid("0a3a93a1-a79c-4d08-8ace-6e72b30c3ab7")]
8+
[assembly: CollectionBehavior(MaxParallelThreads = -1)]

samples/MusicStore/MusicStore.Test/TestStartup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
using System.Reflection;
1111
using Microsoft.AspNetCore.Mvc.ApplicationParts;
1212
using MyTested.AspNetCore.Mvc.Internal;
13-
using MyTested.AspNetCore.Mvc.Session;
13+
using MyTested.AspNetCore.Mvc.Plugins;
1414
#endif
1515

1616
public class TestStartup : Startup

samples/MusicStore/MusicStore.Web/Models/SampleData.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ private static void InsertTestData(IServiceProvider serviceProvider)
3838
{
3939
var albums = GetAlbums(imgUrl, Genres, Artists);
4040

41-
AddOrUpdateAsync(serviceProvider, g => g.GenreId, Genres.Select(genre => genre.Value));
42-
AddOrUpdateAsync(serviceProvider, a => a.ArtistId, Artists.Select(artist => artist.Value));
43-
AddOrUpdateAsync(serviceProvider, a => a.AlbumId, albums);
41+
AddOrUpdate(serviceProvider, g => g.GenreId, Genres.Select(genre => genre.Value));
42+
AddOrUpdate(serviceProvider, a => a.ArtistId, Artists.Select(artist => artist.Value));
43+
AddOrUpdate(serviceProvider, a => a.AlbumId, albums);
4444
}
4545

46-
private static void AddOrUpdateAsync<TEntity>(
46+
private static void AddOrUpdate<TEntity>(
4747
IServiceProvider serviceProvider,
4848
Func<TEntity, object> propertyToMatch, IEnumerable<TEntity> entities)
4949
where TEntity : class

samples/MusicStore/MusicStore.Web/Startup.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ public void Configure(IApplicationBuilder app)
206206
name: "api",
207207
template: "{controller}/{id?}");
208208
});
209+
210+
//Populates the MusicStore sample data
211+
SampleData.InitializeMusicStoreDatabase(app.ApplicationServices, false);
209212
}
210213
}
211214
}

src/MyTested.AspNetCore.Mvc.Caching/Caching/CachingTestPlugin.cs renamed to src/MyTested.AspNetCore.Mvc.Caching/Plugins/CachingTestPlugin.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
namespace MyTested.AspNetCore.Mvc.Caching
1+
namespace MyTested.AspNetCore.Mvc.Plugins
22
{
33
using System;
44
using Internal;
55
using Internal.Application;
66
using Microsoft.Extensions.Caching.Memory;
77
using Microsoft.Extensions.DependencyInjection;
8-
using Plugins;
98

109
public class CachingTestPlugin : IServiceRegistrationPlugin
1110
{

src/MyTested.AspNetCore.Mvc.Core/Builders/ActionResults/BadRequest/BadRequestTestBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ public BadRequestTestBuilder(ControllerTestContext testContext)
4444
/// <inheritdoc />
4545
public IAndModelDetailsTestBuilder<TError> WithError<TError>(TError error)
4646
{
47-
return this.WithResponseModel(error);
47+
return this.WithModel(error);
4848
}
4949

5050
/// <inheritdoc />
5151
public IAndModelDetailsTestBuilder<TError> WithErrorOfType<TError>()
5252
{
53-
return this.WithResponseModelOfType<TError>();
53+
return this.WithModelOfType<TError>();
5454
}
5555

5656
/// <inheritdoc />

src/MyTested.AspNetCore.Mvc.Core/Builders/Base/BaseTestBuilderWithResponseModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ protected BaseTestBuilderWithResponseModel(ControllerTestContext testContext)
5050
protected string OfTypeErrorMessageFormat { get; set; }
5151

5252
/// <inheritdoc />
53-
public IAndModelDetailsTestBuilder<TResponseModel> WithResponseModelOfType<TResponseModel>()
53+
public IAndModelDetailsTestBuilder<TResponseModel> WithModelOfType<TResponseModel>()
5454
{
5555
var actualResponseDataType = this.GetReturnType();
5656
var expectedResponseDataType = typeof(TResponseModel);
@@ -74,9 +74,9 @@ public IAndModelDetailsTestBuilder<TResponseModel> WithResponseModelOfType<TResp
7474
}
7575

7676
/// <inheritdoc />
77-
public IAndModelDetailsTestBuilder<TResponseModel> WithResponseModel<TResponseModel>(TResponseModel expectedModel)
77+
public IAndModelDetailsTestBuilder<TResponseModel> WithModel<TResponseModel>(TResponseModel expectedModel)
7878
{
79-
this.WithResponseModelOfType<TResponseModel>();
79+
this.WithModelOfType<TResponseModel>();
8080

8181
var actualModel = this.GetActualModel<TResponseModel>();
8282
if (Reflection.AreNotDeeplyEqual(expectedModel, actualModel))

src/MyTested.AspNetCore.Mvc.Core/Builders/Contracts/Base/IBaseTestBuilderWithResponseModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ public interface IBaseTestBuilderWithResponseModel : IBaseTestBuilderWithInvoked
1212
/// </summary>
1313
/// <typeparam name="TResponseModel">Type of the response model.</typeparam>
1414
/// <returns>Test builder of <see cref="IModelDetailsTestBuilder{TResponseModel}"/>.</returns>
15-
IAndModelDetailsTestBuilder<TResponseModel> WithResponseModelOfType<TResponseModel>();
15+
IAndModelDetailsTestBuilder<TResponseModel> WithModelOfType<TResponseModel>();
1616

1717
/// <summary>
1818
/// Tests whether a deeply equal object to the provided one is returned from the invoked action.
1919
/// </summary>
2020
/// <typeparam name="TResponseModel">Type of the response model.</typeparam>
2121
/// <param name="expectedModel">Expected model to be returned.</param>
2222
/// <returns>Test builder of <see cref="IModelDetailsTestBuilder{TResponseModel}"/>.</returns>
23-
IAndModelDetailsTestBuilder<TResponseModel> WithResponseModel<TResponseModel>(TResponseModel expectedModel);
23+
IAndModelDetailsTestBuilder<TResponseModel> WithModel<TResponseModel>(TResponseModel expectedModel);
2424
}
2525
}

0 commit comments

Comments
 (0)