-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removing tests from examples solutions.
- Loading branch information
1 parent
02684fa
commit 9c8015c
Showing
26 changed files
with
2,048 additions
and
190 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
69 changes: 69 additions & 0 deletions
69
Tests/RCommon.ApplicationServices.Tests/Commands/CommandBusTests.cs
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Options; | ||
using Moq; | ||
using NUnit.Framework; | ||
using RCommon; | ||
using RCommon.ApplicationServices; | ||
using RCommon.ApplicationServices.Commands; | ||
using RCommon.ApplicationServices.Validation; | ||
using RCommon.Caching; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace RCommon.ApplicationServices.Tests.Commands | ||
{ | ||
[TestFixture] | ||
public class CommandBusTests | ||
{ | ||
private MockRepository mockRepository; | ||
|
||
private Mock<ILogger<CommandBus>> mockLogger; | ||
private Mock<IServiceProvider> mockServiceProvider; | ||
private Mock<IValidationService> mockValidationService; | ||
private Mock<IOptions<CqrsValidationOptions>> mockOptionsCqrsValidationOptions; | ||
private Mock<IOptions<CachingOptions>> mockOptionsCachingOptions; | ||
private Mock<ICommonFactory<ExpressionCachingStrategy, ICacheService>> mockCommonFactory; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
this.mockRepository = new MockRepository(MockBehavior.Strict); | ||
|
||
this.mockLogger = this.mockRepository.Create<ILogger<CommandBus>>(); | ||
this.mockServiceProvider = this.mockRepository.Create<IServiceProvider>(); | ||
this.mockValidationService = this.mockRepository.Create<IValidationService>(); | ||
this.mockOptionsCqrsValidationOptions = this.mockRepository.Create<IOptions<CqrsValidationOptions>>(); | ||
this.mockOptionsCachingOptions = this.mockRepository.Create<IOptions<CachingOptions>>(); | ||
this.mockCommonFactory = this.mockRepository.Create<ICommonFactory<ExpressionCachingStrategy, ICacheService>>(); | ||
} | ||
|
||
private CommandBus CreateCommandBus() | ||
{ | ||
return new CommandBus( | ||
this.mockLogger.Object, | ||
this.mockServiceProvider.Object, | ||
this.mockValidationService.Object, | ||
this.mockOptionsCqrsValidationOptions.Object, | ||
this.mockOptionsCachingOptions.Object, | ||
this.mockCommonFactory.Object); | ||
} | ||
|
||
[Test] | ||
public async Task DispatchCommandAsync_StateUnderTest_ExpectedBehavior() | ||
{ | ||
// Arrange | ||
var commandBus = this.CreateCommandBus(); | ||
ICommand command = null; | ||
CancellationToken cancellationToken = default(global::System.Threading.CancellationToken); | ||
|
||
// Act | ||
var result = await commandBus.DispatchCommandAsync( | ||
command, | ||
cancellationToken); | ||
|
||
// Assert | ||
Assert.Fail(); | ||
this.mockRepository.VerifyAll(); | ||
} | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
Tests/RCommon.ApplicationServices.Tests/Queries/QueryBusTests.cs
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Options; | ||
using Moq; | ||
using NUnit.Framework; | ||
using RCommon; | ||
using RCommon.ApplicationServices; | ||
using RCommon.ApplicationServices.Queries; | ||
using RCommon.ApplicationServices.Validation; | ||
using RCommon.Caching; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace RCommon.ApplicationServices.Tests.Queries | ||
{ | ||
[TestFixture] | ||
public class QueryBusTests | ||
{ | ||
private MockRepository mockRepository; | ||
|
||
private Mock<ILogger<QueryBus>> mockLogger; | ||
private Mock<IServiceProvider> mockServiceProvider; | ||
private Mock<IValidationService> mockValidationService; | ||
private Mock<IOptions<CqrsValidationOptions>> mockOptionsCqrsValidationOptions; | ||
private Mock<IOptions<CachingOptions>> mockOptionsCachingOptions; | ||
private Mock<ICommonFactory<ExpressionCachingStrategy, ICacheService>> mockCommonFactory; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
this.mockRepository = new MockRepository(MockBehavior.Strict); | ||
|
||
this.mockLogger = this.mockRepository.Create<ILogger<QueryBus>>(); | ||
this.mockServiceProvider = this.mockRepository.Create<IServiceProvider>(); | ||
this.mockValidationService = this.mockRepository.Create<IValidationService>(); | ||
this.mockOptionsCqrsValidationOptions = this.mockRepository.Create<IOptions<CqrsValidationOptions>>(); | ||
this.mockOptionsCachingOptions = this.mockRepository.Create<IOptions<CachingOptions>>(); | ||
this.mockCommonFactory = this.mockRepository.Create<ICommonFactory<ExpressionCachingStrategy, ICacheService>>(); | ||
} | ||
|
||
private QueryBus CreateQueryBus() | ||
{ | ||
return new QueryBus( | ||
this.mockLogger.Object, | ||
this.mockServiceProvider.Object, | ||
this.mockValidationService.Object, | ||
this.mockOptionsCqrsValidationOptions.Object, | ||
this.mockOptionsCachingOptions.Object, | ||
this.mockCommonFactory.Object); | ||
} | ||
|
||
[Test] | ||
public async Task DispatchQueryAsync_StateUnderTest_ExpectedBehavior() | ||
{ | ||
// Arrange | ||
var queryBus = this.CreateQueryBus(); | ||
IQuery query = null; | ||
CancellationToken cancellationToken = default(global::System.Threading.CancellationToken); | ||
|
||
// Act | ||
var result = await queryBus.DispatchQueryAsync( | ||
query, | ||
cancellationToken); | ||
|
||
// Assert | ||
Assert.Fail(); | ||
this.mockRepository.VerifyAll(); | ||
} | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
Tests/RCommon.ApplicationServices.Tests/Validation/ValidationOutcomeTests.cs
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using Moq; | ||
using NUnit.Framework; | ||
using RCommon.ApplicationServices.Validation; | ||
using System; | ||
|
||
namespace RCommon.ApplicationServices.Tests.Validation | ||
{ | ||
[TestFixture] | ||
public class ValidationOutcomeTests | ||
{ | ||
private MockRepository mockRepository; | ||
|
||
|
||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
this.mockRepository = new MockRepository(MockBehavior.Strict); | ||
|
||
|
||
} | ||
|
||
private ValidationOutcome CreateValidationOutcome() | ||
{ | ||
return new ValidationOutcome(); | ||
} | ||
|
||
[Test] | ||
public void ToString_StateUnderTest_ExpectedBehavior() | ||
{ | ||
// Arrange | ||
var validationOutcome = this.CreateValidationOutcome(); | ||
|
||
// Act | ||
var result = validationOutcome.ToString(); | ||
|
||
// Assert | ||
Assert.Fail(); | ||
this.mockRepository.VerifyAll(); | ||
} | ||
|
||
[Test] | ||
public void ToString_StateUnderTest_ExpectedBehavior1() | ||
{ | ||
// Arrange | ||
var validationOutcome = this.CreateValidationOutcome(); | ||
string separator = null; | ||
|
||
// Act | ||
var result = validationOutcome.ToString( | ||
separator); | ||
|
||
// Assert | ||
Assert.Fail(); | ||
this.mockRepository.VerifyAll(); | ||
} | ||
|
||
[Test] | ||
public void ToDictionary_StateUnderTest_ExpectedBehavior() | ||
{ | ||
// Arrange | ||
var validationOutcome = this.CreateValidationOutcome(); | ||
|
||
// Act | ||
var result = validationOutcome.ToDictionary(); | ||
|
||
// Assert | ||
Assert.Fail(); | ||
this.mockRepository.VerifyAll(); | ||
} | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
Tests/RCommon.ApplicationServices.Tests/Validation/ValidationServiceTests.cs
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using Moq; | ||
using NUnit.Framework; | ||
using RCommon.ApplicationServices.Validation; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace RCommon.ApplicationServices.Tests.Validation | ||
{ | ||
[TestFixture] | ||
public class ValidationServiceTests | ||
{ | ||
private MockRepository mockRepository; | ||
|
||
private Mock<IServiceProvider> mockServiceProvider; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
this.mockRepository = new MockRepository(MockBehavior.Strict); | ||
|
||
this.mockServiceProvider = this.mockRepository.Create<IServiceProvider>(); | ||
} | ||
|
||
private ValidationService CreateService() | ||
{ | ||
return new ValidationService( | ||
this.mockServiceProvider.Object); | ||
} | ||
|
||
[Test] | ||
public async Task ValidateAsync_StateUnderTest_ExpectedBehavior() | ||
{ | ||
// Arrange | ||
var service = this.CreateService(); | ||
T target = null; | ||
bool throwOnFaults = false; | ||
CancellationToken cancellationToken = default(global::System.Threading.CancellationToken); | ||
|
||
// Act | ||
var result = await service.ValidateAsync( | ||
target, | ||
throwOnFaults, | ||
cancellationToken); | ||
|
||
// Assert | ||
Assert.Fail(); | ||
this.mockRepository.VerifyAll(); | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
Tests/RCommon.Core.Tests/Reflection/ObjectGraphWalkerTests.cs
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using Moq; | ||
using NUnit.Framework; | ||
using RCommon.Reflection; | ||
using System; | ||
|
||
namespace RCommon.Core.Tests.Reflection | ||
{ | ||
[TestFixture] | ||
public class ObjectGraphWalkerTests | ||
{ | ||
private MockRepository mockRepository; | ||
|
||
|
||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
this.mockRepository = new MockRepository(MockBehavior.Strict); | ||
|
||
|
||
} | ||
|
||
private ObjectGraphWalker CreateObjectGraphWalker() | ||
{ | ||
return new ObjectGraphWalker(); | ||
} | ||
|
||
[Test] | ||
public void TraverseGraphFor_StateUnderTest_ExpectedBehavior() | ||
{ | ||
// Arrange | ||
var objectGraphWalker = this.CreateObjectGraphWalker(); | ||
object root = null; | ||
|
||
// Act | ||
var result = objectGraphWalker.TraverseGraphFor( | ||
root); | ||
|
||
// Assert | ||
Assert.Fail(); | ||
this.mockRepository.VerifyAll(); | ||
} | ||
} | ||
} |
Oops, something went wrong.