-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
55 changed files
with
1,002 additions
and
1,052 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
using EvoSC.Common.Interfaces.Controllers; | ||
using EvoSC.Common.Interfaces.Services; | ||
using EvoSC.Common.Interfaces.Util.Auditing; | ||
using Moq; | ||
using NSubstitute; | ||
|
||
namespace EvoSC.Testing.Controllers; | ||
|
||
public class ControllerContextMock<TContext> where TContext : class, IControllerContext | ||
{ | ||
private Mock<IContextService> _contextService; | ||
private Mock<TContext> _context; | ||
private Mock<IAuditService> _auditService; | ||
private Mock<IAuditEventBuilder> _auditEventBuilder; | ||
private IContextService _contextService; | ||
private TContext _context; | ||
private IAuditService _auditService; | ||
private IAuditEventBuilder _auditEventBuilder; | ||
|
||
/// <summary> | ||
/// The context mock. | ||
/// </summary> | ||
public Mock<TContext> Context => _context; | ||
public TContext Context => _context; | ||
|
||
/// <summary> | ||
/// The context service mock. | ||
/// </summary> | ||
public Mock<IContextService> ContextService => _contextService; | ||
public IContextService ContextService => _contextService; | ||
|
||
/// <summary> | ||
/// The audit service mock. | ||
/// </summary> | ||
public Mock<IAuditService> AuditService => _auditService; | ||
public IAuditService AuditService => _auditService; | ||
|
||
/// <summary> | ||
/// The audit event builder mock. | ||
/// </summary> | ||
public Mock<IAuditEventBuilder> AuditEventBuilder => _auditEventBuilder; | ||
public IAuditEventBuilder AuditEventBuilder => _auditEventBuilder; | ||
|
||
public ControllerContextMock() | ||
{ | ||
_auditService = new Mock<IAuditService>(); | ||
_auditService = Substitute.For<IAuditService>(); | ||
_auditEventBuilder = Mocking.NewAuditEventBuilderMock(); | ||
|
||
_context = new Mock<TContext>(); | ||
_context.Setup(c => c.AuditEvent).Returns(_auditEventBuilder.Object); | ||
_context = Substitute.For<TContext>(); | ||
_context.AuditEvent.Returns(_auditEventBuilder); | ||
|
||
_contextService = Mocking.NewContextServiceMock(Context.Object, null); | ||
_contextService = Mocking.NewContextServiceMock(Context, null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.