Skip to content

Commit 2902ecc

Browse files
committed
feat: create mock factories for dependencies of use case
1 parent 99c122b commit 2902ecc

5 files changed

Lines changed: 53 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Moq;
2+
using RecipesApp.Domain.Repositories;
3+
4+
namespace CommonTestUtilities.Repositories;
5+
6+
public class UnitOfWorkMockFactory
7+
{
8+
public static IUnitOfWork CreateMock()
9+
=> new Mock<IUnitOfWork>().Object;
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Moq;
2+
using RecipesApp.Domain.Repositories.User;
3+
4+
namespace CommonTestUtilities.Repositories;
5+
6+
public class UserReadOnlyRepositoryMockFactory
7+
{
8+
public static IUserReadOnlyRepository CreateMock()
9+
=> new Mock<IUserReadOnlyRepository>().Object;
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Moq;
2+
using RecipesApp.Domain.Repositories.User;
3+
4+
namespace CommonTestUtilities.Repositories;
5+
6+
public class UserWriteOnlyRepositoryMockFactory
7+
{
8+
public static IUserWriteOnlyRepository CreateMock()
9+
=> new Mock<IUserWriteOnlyRepository>().Object;
10+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using RecipesApp.Application.Services;
2+
3+
namespace CommonTestUtilities.Services;
4+
5+
public class EncryptMockFactory
6+
{
7+
public static PasswordEncryptionService CreateMock()
8+
=> new PasswordEncryptionService("dot");
9+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using AutoMapper;
2+
using RecipesApp.Application.Services;
3+
4+
namespace CommonTestUtilities.Services;
5+
6+
public class MapperMockFactory
7+
{
8+
public static IMapper CreateMock()
9+
{
10+
return new MapperConfiguration(
11+
options => { options.AddProfile(new AutoMappingService()); }
12+
).CreateMapper();
13+
}
14+
}

0 commit comments

Comments
 (0)