Skip to content

Commit

Permalink
Removing tests from examples solutions.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmwebb-lv committed Nov 2, 2024
1 parent 02684fa commit 9c8015c
Show file tree
Hide file tree
Showing 26 changed files with 2,048 additions and 190 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<ProjectReference Include="..\..\..\Src\RCommon.Persistence.Caching.MemoryCache\RCommon.Persistence.Caching.MemoryCache.csproj" />
<ProjectReference Include="..\..\..\Src\RCommon.Persistence.Caching\RCommon.Persistence.Caching.csproj" />
<ProjectReference Include="..\..\..\Src\RCommon.Persistence\RCommon.Persistence.csproj" />
<ProjectReference Include="..\..\..\Tests\RCommon.TestBase.Data\RCommon.TestBase.Data.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\Tests\RCommon.TestBase\RCommon.TestBase.csproj" />
<ProjectReference Include="..\HR.LeaveManagement.Application\HR.LeaveManagement.Application.csproj" />
</ItemGroup>
</Project>
188 changes: 0 additions & 188 deletions Examples/Examples.sln

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Src/RCommon.sln
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Messaging", "Messaging", "{
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mediator", "Mediator", "{6C1DEC4A-1F41-458B-9C14-74399516CC99}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCommon.Persistence.Caching.Tests", "..\Tests\RCommon.Persistence.Caching.Tests\RCommon.Persistence.Caching.Tests.csproj", "{B2112C06-CC7F-450A-964A-C2E8CF30A33F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -367,6 +369,10 @@ Global
{7B5600C0-420E-4713-BBF7-B53F183F8048}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B5600C0-420E-4713-BBF7-B53F183F8048}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B5600C0-420E-4713-BBF7-B53F183F8048}.Release|Any CPU.Build.0 = Release|Any CPU
{B2112C06-CC7F-450A-964A-C2E8CF30A33F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B2112C06-CC7F-450A-964A-C2E8CF30A33F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2112C06-CC7F-450A-964A-C2E8CF30A33F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2112C06-CC7F-450A-964A-C2E8CF30A33F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -428,6 +434,7 @@ Global
{7B5600C0-420E-4713-BBF7-B53F183F8048} = {F52A5CE5-42A2-45A6-A5A5-468B15AC8F7B}
{F52A5CE5-42A2-45A6-A5A5-468B15AC8F7B} = {0AF37317-F10E-47E8-A4C8-9EA886E00E40}
{6C1DEC4A-1F41-458B-9C14-74399516CC99} = {0AF37317-F10E-47E8-A4C8-9EA886E00E40}
{B2112C06-CC7F-450A-964A-C2E8CF30A33F} = {42AC96AA-056F-4159-87BA-A16FC12504AE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0B0CD26D-8067-4667-863E-6B0EE7EDAA42}
Expand Down
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 Tests/RCommon.ApplicationServices.Tests/Queries/QueryBusTests.cs
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();
}
}
}
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();
}
}
}
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 Tests/RCommon.Core.Tests/Reflection/ObjectGraphWalkerTests.cs
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();
}
}
}
Loading

0 comments on commit 9c8015c

Please sign in to comment.