diff --git a/Examples/Caching/Examples.Caching.PersistenceCaching/Examples.Caching.PersistenceCaching.csproj b/Examples/Caching/Examples.Caching.PersistenceCaching/Examples.Caching.PersistenceCaching.csproj index 1f78af89..ea638310 100644 --- a/Examples/Caching/Examples.Caching.PersistenceCaching/Examples.Caching.PersistenceCaching.csproj +++ b/Examples/Caching/Examples.Caching.PersistenceCaching/Examples.Caching.PersistenceCaching.csproj @@ -12,7 +12,6 @@ - diff --git a/Examples/CleanWithCQRS/HR.LeaveManagement.Application.UnitTests/HR.LeaveManagement.Application.UnitTests.csproj b/Examples/CleanWithCQRS/HR.LeaveManagement.Application.UnitTests/HR.LeaveManagement.Application.UnitTests.csproj index 065e1b9f..dfeaeded 100644 --- a/Examples/CleanWithCQRS/HR.LeaveManagement.Application.UnitTests/HR.LeaveManagement.Application.UnitTests.csproj +++ b/Examples/CleanWithCQRS/HR.LeaveManagement.Application.UnitTests/HR.LeaveManagement.Application.UnitTests.csproj @@ -29,7 +29,6 @@ - diff --git a/Examples/Examples.sln b/Examples/Examples.sln index e1fd495e..6cfebfad 100644 --- a/Examples/Examples.sln +++ b/Examples/Examples.sln @@ -5,14 +5,8 @@ VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.Core", "..\Src\RCommon.Core\RCommon.Core.csproj", "{04F96FF4-7229-4468-A486-086993EFD2A2}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{0AF37317-F10E-47E8-A4C8-9EA886E00E40}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{3234C3BB-1632-4684-838E-9D6D382D4D4D}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.TestBase", "..\Tests\RCommon.TestBase\RCommon.TestBase.csproj", "{3A6EE1AD-5E24-4CA4-B64D-E1517EB2DF63}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Framework", "Framework", "{788A01F9-0510-441A-B05B-0CDA0EE87507}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.ApplicationServices", "..\Src\RCommon.ApplicationServices\RCommon.ApplicationServices.csproj", "{77C5C4DB-9D8B-4CE7-824D-C4A8AD3A4056}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.Entities", "..\Src\RCommon.Entities\RCommon.Entities.csproj", "{A09E85E5-6453-437F-9D5D-A31972B8D1F3}" @@ -45,34 +39,20 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HR.LeaveManagement.MVC", "C EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HR.LeaveManagement.Persistence", "CleanWithCQRS\HR.LeaveManagement.Persistence\HR.LeaveManagement.Persistence.csproj", "{055D20CD-E279-453A-BFCD-545669BF672B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.Security.Tests", "..\Tests\RCommon.Security.Tests\RCommon.Security.Tests.csproj", "{B337BA69-43B6-4475-A3A3-1C6540A02C99}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.Security", "..\Src\RCommon.Security\RCommon.Security.csproj", "{16B004B0-B8E9-474C-A10B-7BD4CC9AEF9E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.Emailing", "..\Src\RCommon.Emailing\RCommon.Emailing.csproj", "{E4813CDB-BF79-459F-A9A0-A1FC2F5A96C4}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.SendGrid", "..\Src\RCommon.SendGrid\RCommon.SendGrid.csproj", "{D8206662-51A8-4407-8B0D-8E5F53A73F19}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.Emailing.Tests", "..\Tests\RCommon.Emailing.Tests\RCommon.Emailing.Tests.csproj", "{338D0653-63A9-401E-AC2C-2804BC7FEE1D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.Emailing.SendGrid.Tests", "..\Tests\RCommon.Emailing.SendGrid.Tests\RCommon.Emailing.SendGrid.Tests.csproj", "{02314B28-8C8C-4341-8D3B-598FEA8CFF8E}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.Linq2Db", "..\Src\RCommon.Linq2Db\RCommon.Linq2Db.csproj", "{2B494844-B218-43B8-9FC3-9D0B2BC22BD6}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.TestBase.Data", "..\Tests\RCommon.TestBase.Data\RCommon.TestBase.Data.csproj", "{B608157C-D7AE-410E-9284-64A30B0B5404}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.MassTransit", "..\Src\RCommon.MassTransit\RCommon.MassTransit.csproj", "{D9B8D10F-3206-482F-8C4F-8079408ED224}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Persistence", "Persistence", "{0FC00E76-4E4B-4E09-B11A-5024EDBBC145}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Messaging", "Messaging", "{F026BAB4-FBBE-4AF5-8187-AA3ADF540053}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.MediatR", "..\Src\RCommon.Mediatr\RCommon.MediatR.csproj", "{0987AF3F-6EFC-4AE6-9007-DE9533934D82}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.Mediator", "..\Src\RCommon.Mediator\RCommon.Mediator.csproj", "{0CE7EC46-274F-4D46-A344-1F92E1D23923}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mediators", "Mediators", "{86B19A1B-17F9-410F-8B97-74FE3EE7A4BE}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Messaging", "Messaging", "{35AE0870-0A6D-4F27-B534-B8DCDFD11A36}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Providers", "Providers", "{3199F749-0082-41D0-91D3-ECED117F8B08}" @@ -135,48 +115,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.Persistence.Caching EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.Persistence.Caching.RedisCache", "..\Src\RCommon.Persistence.Caching.RedisCache\RCommon.Persistence.Caching.RedisCache.csproj", "{924B529F-D036-464B-B1A6-257CD95143B4}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.Core.Tests", "..\Tests\RCommon.Core.Tests\RCommon.Core.Tests.csproj", "{6CC256C4-2CE7-4396-A40A-FC55F83189AA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCommon.Caching.Tests", "..\Tests\RCommon.Caching.Tests\RCommon.Caching.Tests.csproj", "{3D1C3CB4-663C-439B-A3BA-FADBC951DE19}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCommon.ApplicationServices.Tests", "..\Tests\RCommon.ApplicationServices.Tests\RCommon.ApplicationServices.Tests.csproj", "{7D864B82-CF04-43CC-A36F-28DD4B3A8FD9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCommon.EFCore.Tests", "..\Tests\RCommon.EFCore.Tests\RCommon.EFCore.Tests.csproj", "{F29089EE-1E58-461B-8408-B6093FBA444D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RCommon.Dapper.Tests", "..\Tests\RCommon.Dapper.Tests\RCommon.Dapper.Tests.csproj", "{B3F77BE5-F7ED-41C9-B5CC-B82B98BFEA2A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCommon.Linq2Db.Tests", "..\Tests\RCommon.Linq2Db.Tests\RCommon.Linq2Db.Tests.csproj", "{15EE68C6-F328-4ED8-BC1E-A637250B7F9F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCommon.Mediator.Tests", "..\Tests\RCommon.Mediator.Tests\RCommon.Mediator.Tests.csproj", "{A6E37A46-84F4-4C8B-A8D1-5E389A458893}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCommon.MediatR.Tests", "..\Tests\RCommon.MediatR.Tests\RCommon.MediatR.Tests.csproj", "{4C8698C3-D3D7-43E5-93E5-DF5A687A9ECC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCommon.Wolverine.Tests", "..\Tests\RCommon.Wolverine.Tests\RCommon.Wolverine.Tests.csproj", "{977141C7-27F0-4BC4-81FF-FF9D7A452332}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCommon.MassTransit.Tests", "..\Tests\RCommon.MassTransit.Tests\RCommon.MassTransit.Tests.csproj", "{CF532FBC-DE02-4824-B469-2BBB5625B85D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCommon.Persistence.Tests", "..\Tests\RCommon.Persistence.Tests\RCommon.Persistence.Tests.csproj", "{AFF7D4F6-3BC8-42B6-8536-F43108320E30}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCommon.Json.Tests", "..\Tests\RCommon.Json.Tests\RCommon.Json.Tests.csproj", "{01A15E08-A422-4AF3-8241-D3466D5CD9B3}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Serialization", "Serialization", "{227AEB37-EA4B-4ABD-929D-9E4A010BC30D}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caching", "Caching", "{1FC7F5F3-77C7-464A-B571-5953242782D8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCommon.SystemTextJson.Tests", "..\Tests\RCommon.SystemTextJson.Tests\RCommon.SystemTextJson.Tests.csproj", "{CDACF4FC-7B0F-4EF5-A5BB-E71110A00C6B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCommon.JsonNet.Tests", "..\Tests\RCommon.JsonNet.Tests\RCommon.JsonNet.Tests.csproj", "{020A13D7-4A66-4F88-B3C3-52342FA25C90}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCommon.MemoryCache.Tests", "..\Tests\RCommon.MemoryCache.Tests\RCommon.MemoryCache.Tests.csproj", "{1790AB06-4AB8-47C0-8C68-798BCBD310FE}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCommon.RedisCache.Tests", "..\Tests\RCommon.RedisCache.Tests\RCommon.RedisCache.Tests.csproj", "{B51471DF-9B83-48F2-A705-5FB357A003C2}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCommon.Entities.Tests", "..\Tests\RCommon.Entities.Tests\RCommon.Entities.Tests.csproj", "{D90F08A6-5658-4DFE-A203-50B092CCD90F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCommon.Models.Tests", "..\Tests\RCommon.Models.Tests\RCommon.Models.Tests.csproj", "{32EA8BAC-5AF8-4310-BB0F-044C8A83ADEA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RCommon.FluentValidation.Tests", "..\Tests\RCommon.FluentValidation.Tests\RCommon.FluentValidation.Tests.csproj", "{B76A68AA-2B92-48D9-809A-8BF56126A577}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -187,10 +125,6 @@ Global {04F96FF4-7229-4468-A486-086993EFD2A2}.Debug|Any CPU.Build.0 = Debug|Any CPU {04F96FF4-7229-4468-A486-086993EFD2A2}.Release|Any CPU.ActiveCfg = Release|Any CPU {04F96FF4-7229-4468-A486-086993EFD2A2}.Release|Any CPU.Build.0 = Release|Any CPU - {3A6EE1AD-5E24-4CA4-B64D-E1517EB2DF63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3A6EE1AD-5E24-4CA4-B64D-E1517EB2DF63}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3A6EE1AD-5E24-4CA4-B64D-E1517EB2DF63}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3A6EE1AD-5E24-4CA4-B64D-E1517EB2DF63}.Release|Any CPU.Build.0 = Release|Any CPU {77C5C4DB-9D8B-4CE7-824D-C4A8AD3A4056}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {77C5C4DB-9D8B-4CE7-824D-C4A8AD3A4056}.Debug|Any CPU.Build.0 = Debug|Any CPU {77C5C4DB-9D8B-4CE7-824D-C4A8AD3A4056}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -251,10 +185,6 @@ Global {055D20CD-E279-453A-BFCD-545669BF672B}.Debug|Any CPU.Build.0 = Debug|Any CPU {055D20CD-E279-453A-BFCD-545669BF672B}.Release|Any CPU.ActiveCfg = Release|Any CPU {055D20CD-E279-453A-BFCD-545669BF672B}.Release|Any CPU.Build.0 = Release|Any CPU - {B337BA69-43B6-4475-A3A3-1C6540A02C99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B337BA69-43B6-4475-A3A3-1C6540A02C99}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B337BA69-43B6-4475-A3A3-1C6540A02C99}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B337BA69-43B6-4475-A3A3-1C6540A02C99}.Release|Any CPU.Build.0 = Release|Any CPU {16B004B0-B8E9-474C-A10B-7BD4CC9AEF9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {16B004B0-B8E9-474C-A10B-7BD4CC9AEF9E}.Debug|Any CPU.Build.0 = Debug|Any CPU {16B004B0-B8E9-474C-A10B-7BD4CC9AEF9E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -267,22 +197,10 @@ Global {D8206662-51A8-4407-8B0D-8E5F53A73F19}.Debug|Any CPU.Build.0 = Debug|Any CPU {D8206662-51A8-4407-8B0D-8E5F53A73F19}.Release|Any CPU.ActiveCfg = Release|Any CPU {D8206662-51A8-4407-8B0D-8E5F53A73F19}.Release|Any CPU.Build.0 = Release|Any CPU - {338D0653-63A9-401E-AC2C-2804BC7FEE1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {338D0653-63A9-401E-AC2C-2804BC7FEE1D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {338D0653-63A9-401E-AC2C-2804BC7FEE1D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {338D0653-63A9-401E-AC2C-2804BC7FEE1D}.Release|Any CPU.Build.0 = Release|Any CPU - {02314B28-8C8C-4341-8D3B-598FEA8CFF8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {02314B28-8C8C-4341-8D3B-598FEA8CFF8E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {02314B28-8C8C-4341-8D3B-598FEA8CFF8E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {02314B28-8C8C-4341-8D3B-598FEA8CFF8E}.Release|Any CPU.Build.0 = Release|Any CPU {2B494844-B218-43B8-9FC3-9D0B2BC22BD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2B494844-B218-43B8-9FC3-9D0B2BC22BD6}.Debug|Any CPU.Build.0 = Debug|Any CPU {2B494844-B218-43B8-9FC3-9D0B2BC22BD6}.Release|Any CPU.ActiveCfg = Release|Any CPU {2B494844-B218-43B8-9FC3-9D0B2BC22BD6}.Release|Any CPU.Build.0 = Release|Any CPU - {B608157C-D7AE-410E-9284-64A30B0B5404}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B608157C-D7AE-410E-9284-64A30B0B5404}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B608157C-D7AE-410E-9284-64A30B0B5404}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B608157C-D7AE-410E-9284-64A30B0B5404}.Release|Any CPU.Build.0 = Release|Any CPU {D9B8D10F-3206-482F-8C4F-8079408ED224}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D9B8D10F-3206-482F-8C4F-8079408ED224}.Debug|Any CPU.Build.0 = Debug|Any CPU {D9B8D10F-3206-482F-8C4F-8079408ED224}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -387,89 +305,11 @@ Global {924B529F-D036-464B-B1A6-257CD95143B4}.Debug|Any CPU.Build.0 = Debug|Any CPU {924B529F-D036-464B-B1A6-257CD95143B4}.Release|Any CPU.ActiveCfg = Release|Any CPU {924B529F-D036-464B-B1A6-257CD95143B4}.Release|Any CPU.Build.0 = Release|Any CPU - {6CC256C4-2CE7-4396-A40A-FC55F83189AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6CC256C4-2CE7-4396-A40A-FC55F83189AA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6CC256C4-2CE7-4396-A40A-FC55F83189AA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6CC256C4-2CE7-4396-A40A-FC55F83189AA}.Release|Any CPU.Build.0 = Release|Any CPU - {3D1C3CB4-663C-439B-A3BA-FADBC951DE19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3D1C3CB4-663C-439B-A3BA-FADBC951DE19}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3D1C3CB4-663C-439B-A3BA-FADBC951DE19}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3D1C3CB4-663C-439B-A3BA-FADBC951DE19}.Release|Any CPU.Build.0 = Release|Any CPU - {7D864B82-CF04-43CC-A36F-28DD4B3A8FD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7D864B82-CF04-43CC-A36F-28DD4B3A8FD9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7D864B82-CF04-43CC-A36F-28DD4B3A8FD9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7D864B82-CF04-43CC-A36F-28DD4B3A8FD9}.Release|Any CPU.Build.0 = Release|Any CPU - {F29089EE-1E58-461B-8408-B6093FBA444D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F29089EE-1E58-461B-8408-B6093FBA444D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F29089EE-1E58-461B-8408-B6093FBA444D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F29089EE-1E58-461B-8408-B6093FBA444D}.Release|Any CPU.Build.0 = Release|Any CPU - {B3F77BE5-F7ED-41C9-B5CC-B82B98BFEA2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B3F77BE5-F7ED-41C9-B5CC-B82B98BFEA2A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B3F77BE5-F7ED-41C9-B5CC-B82B98BFEA2A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B3F77BE5-F7ED-41C9-B5CC-B82B98BFEA2A}.Release|Any CPU.Build.0 = Release|Any CPU - {15EE68C6-F328-4ED8-BC1E-A637250B7F9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {15EE68C6-F328-4ED8-BC1E-A637250B7F9F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {15EE68C6-F328-4ED8-BC1E-A637250B7F9F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {15EE68C6-F328-4ED8-BC1E-A637250B7F9F}.Release|Any CPU.Build.0 = Release|Any CPU - {A6E37A46-84F4-4C8B-A8D1-5E389A458893}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A6E37A46-84F4-4C8B-A8D1-5E389A458893}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A6E37A46-84F4-4C8B-A8D1-5E389A458893}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A6E37A46-84F4-4C8B-A8D1-5E389A458893}.Release|Any CPU.Build.0 = Release|Any CPU - {4C8698C3-D3D7-43E5-93E5-DF5A687A9ECC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4C8698C3-D3D7-43E5-93E5-DF5A687A9ECC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4C8698C3-D3D7-43E5-93E5-DF5A687A9ECC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4C8698C3-D3D7-43E5-93E5-DF5A687A9ECC}.Release|Any CPU.Build.0 = Release|Any CPU - {977141C7-27F0-4BC4-81FF-FF9D7A452332}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {977141C7-27F0-4BC4-81FF-FF9D7A452332}.Debug|Any CPU.Build.0 = Debug|Any CPU - {977141C7-27F0-4BC4-81FF-FF9D7A452332}.Release|Any CPU.ActiveCfg = Release|Any CPU - {977141C7-27F0-4BC4-81FF-FF9D7A452332}.Release|Any CPU.Build.0 = Release|Any CPU - {CF532FBC-DE02-4824-B469-2BBB5625B85D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CF532FBC-DE02-4824-B469-2BBB5625B85D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CF532FBC-DE02-4824-B469-2BBB5625B85D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CF532FBC-DE02-4824-B469-2BBB5625B85D}.Release|Any CPU.Build.0 = Release|Any CPU - {AFF7D4F6-3BC8-42B6-8536-F43108320E30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AFF7D4F6-3BC8-42B6-8536-F43108320E30}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AFF7D4F6-3BC8-42B6-8536-F43108320E30}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AFF7D4F6-3BC8-42B6-8536-F43108320E30}.Release|Any CPU.Build.0 = Release|Any CPU - {01A15E08-A422-4AF3-8241-D3466D5CD9B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {01A15E08-A422-4AF3-8241-D3466D5CD9B3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {01A15E08-A422-4AF3-8241-D3466D5CD9B3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {01A15E08-A422-4AF3-8241-D3466D5CD9B3}.Release|Any CPU.Build.0 = Release|Any CPU - {CDACF4FC-7B0F-4EF5-A5BB-E71110A00C6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CDACF4FC-7B0F-4EF5-A5BB-E71110A00C6B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CDACF4FC-7B0F-4EF5-A5BB-E71110A00C6B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CDACF4FC-7B0F-4EF5-A5BB-E71110A00C6B}.Release|Any CPU.Build.0 = Release|Any CPU - {020A13D7-4A66-4F88-B3C3-52342FA25C90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {020A13D7-4A66-4F88-B3C3-52342FA25C90}.Debug|Any CPU.Build.0 = Debug|Any CPU - {020A13D7-4A66-4F88-B3C3-52342FA25C90}.Release|Any CPU.ActiveCfg = Release|Any CPU - {020A13D7-4A66-4F88-B3C3-52342FA25C90}.Release|Any CPU.Build.0 = Release|Any CPU - {1790AB06-4AB8-47C0-8C68-798BCBD310FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1790AB06-4AB8-47C0-8C68-798BCBD310FE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1790AB06-4AB8-47C0-8C68-798BCBD310FE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1790AB06-4AB8-47C0-8C68-798BCBD310FE}.Release|Any CPU.Build.0 = Release|Any CPU - {B51471DF-9B83-48F2-A705-5FB357A003C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B51471DF-9B83-48F2-A705-5FB357A003C2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B51471DF-9B83-48F2-A705-5FB357A003C2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B51471DF-9B83-48F2-A705-5FB357A003C2}.Release|Any CPU.Build.0 = Release|Any CPU - {D90F08A6-5658-4DFE-A203-50B092CCD90F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D90F08A6-5658-4DFE-A203-50B092CCD90F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D90F08A6-5658-4DFE-A203-50B092CCD90F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D90F08A6-5658-4DFE-A203-50B092CCD90F}.Release|Any CPU.Build.0 = Release|Any CPU - {32EA8BAC-5AF8-4310-BB0F-044C8A83ADEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {32EA8BAC-5AF8-4310-BB0F-044C8A83ADEA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {32EA8BAC-5AF8-4310-BB0F-044C8A83ADEA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {32EA8BAC-5AF8-4310-BB0F-044C8A83ADEA}.Release|Any CPU.Build.0 = Release|Any CPU - {B76A68AA-2B92-48D9-809A-8BF56126A577}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B76A68AA-2B92-48D9-809A-8BF56126A577}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B76A68AA-2B92-48D9-809A-8BF56126A577}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B76A68AA-2B92-48D9-809A-8BF56126A577}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {3A6EE1AD-5E24-4CA4-B64D-E1517EB2DF63} = {788A01F9-0510-441A-B05B-0CDA0EE87507} - {788A01F9-0510-441A-B05B-0CDA0EE87507} = {0AF37317-F10E-47E8-A4C8-9EA886E00E40} {CADD5842-C3F4-4E70-8C5D-C447827A83C2} = {3199F749-0082-41D0-91D3-ECED117F8B08} {A570C8FC-AEEB-49DF-9A47-9EDB027BEC67} = {3199F749-0082-41D0-91D3-ECED117F8B08} {41744E85-4BE4-4DA4-91B8-0DFA262CB11B} = {3234C3BB-1632-4684-838E-9D6D382D4D4D} @@ -480,17 +320,10 @@ Global {7BA1DE7E-B862-4A0C-A6BF-EBF99C3AEB8B} = {41744E85-4BE4-4DA4-91B8-0DFA262CB11B} {8C68F8CB-DE35-4078-9F33-4691C56B1E52} = {41744E85-4BE4-4DA4-91B8-0DFA262CB11B} {055D20CD-E279-453A-BFCD-545669BF672B} = {41744E85-4BE4-4DA4-91B8-0DFA262CB11B} - {B337BA69-43B6-4475-A3A3-1C6540A02C99} = {0AF37317-F10E-47E8-A4C8-9EA886E00E40} {D8206662-51A8-4407-8B0D-8E5F53A73F19} = {3199F749-0082-41D0-91D3-ECED117F8B08} - {338D0653-63A9-401E-AC2C-2804BC7FEE1D} = {0AF37317-F10E-47E8-A4C8-9EA886E00E40} - {02314B28-8C8C-4341-8D3B-598FEA8CFF8E} = {0AF37317-F10E-47E8-A4C8-9EA886E00E40} {2B494844-B218-43B8-9FC3-9D0B2BC22BD6} = {3199F749-0082-41D0-91D3-ECED117F8B08} - {B608157C-D7AE-410E-9284-64A30B0B5404} = {788A01F9-0510-441A-B05B-0CDA0EE87507} {D9B8D10F-3206-482F-8C4F-8079408ED224} = {3199F749-0082-41D0-91D3-ECED117F8B08} - {0FC00E76-4E4B-4E09-B11A-5024EDBBC145} = {0AF37317-F10E-47E8-A4C8-9EA886E00E40} - {F026BAB4-FBBE-4AF5-8187-AA3ADF540053} = {0AF37317-F10E-47E8-A4C8-9EA886E00E40} {0987AF3F-6EFC-4AE6-9007-DE9533934D82} = {3199F749-0082-41D0-91D3-ECED117F8B08} - {86B19A1B-17F9-410F-8B97-74FE3EE7A4BE} = {0AF37317-F10E-47E8-A4C8-9EA886E00E40} {35AE0870-0A6D-4F27-B534-B8DCDFD11A36} = {3234C3BB-1632-4684-838E-9D6D382D4D4D} {90B4A098-01AB-4B35-987E-838F2241DA17} = {3199F749-0082-41D0-91D3-ECED117F8B08} {FCC70943-06B2-4743-A99D-82F5122297F3} = {3234C3BB-1632-4684-838E-9D6D382D4D4D} @@ -518,27 +351,6 @@ Global {F5277287-1776-494B-92EE-7237D1B8949B} = {3199F749-0082-41D0-91D3-ECED117F8B08} {B10EBC65-DB29-44AE-8BEB-E4BD170924C3} = {3199F749-0082-41D0-91D3-ECED117F8B08} {924B529F-D036-464B-B1A6-257CD95143B4} = {3199F749-0082-41D0-91D3-ECED117F8B08} - {6CC256C4-2CE7-4396-A40A-FC55F83189AA} = {0AF37317-F10E-47E8-A4C8-9EA886E00E40} - {3D1C3CB4-663C-439B-A3BA-FADBC951DE19} = {1FC7F5F3-77C7-464A-B571-5953242782D8} - {7D864B82-CF04-43CC-A36F-28DD4B3A8FD9} = {0AF37317-F10E-47E8-A4C8-9EA886E00E40} - {F29089EE-1E58-461B-8408-B6093FBA444D} = {0FC00E76-4E4B-4E09-B11A-5024EDBBC145} - {B3F77BE5-F7ED-41C9-B5CC-B82B98BFEA2A} = {0FC00E76-4E4B-4E09-B11A-5024EDBBC145} - {15EE68C6-F328-4ED8-BC1E-A637250B7F9F} = {0FC00E76-4E4B-4E09-B11A-5024EDBBC145} - {A6E37A46-84F4-4C8B-A8D1-5E389A458893} = {86B19A1B-17F9-410F-8B97-74FE3EE7A4BE} - {4C8698C3-D3D7-43E5-93E5-DF5A687A9ECC} = {86B19A1B-17F9-410F-8B97-74FE3EE7A4BE} - {977141C7-27F0-4BC4-81FF-FF9D7A452332} = {F026BAB4-FBBE-4AF5-8187-AA3ADF540053} - {CF532FBC-DE02-4824-B469-2BBB5625B85D} = {F026BAB4-FBBE-4AF5-8187-AA3ADF540053} - {AFF7D4F6-3BC8-42B6-8536-F43108320E30} = {0FC00E76-4E4B-4E09-B11A-5024EDBBC145} - {01A15E08-A422-4AF3-8241-D3466D5CD9B3} = {227AEB37-EA4B-4ABD-929D-9E4A010BC30D} - {227AEB37-EA4B-4ABD-929D-9E4A010BC30D} = {0AF37317-F10E-47E8-A4C8-9EA886E00E40} - {1FC7F5F3-77C7-464A-B571-5953242782D8} = {0AF37317-F10E-47E8-A4C8-9EA886E00E40} - {CDACF4FC-7B0F-4EF5-A5BB-E71110A00C6B} = {227AEB37-EA4B-4ABD-929D-9E4A010BC30D} - {020A13D7-4A66-4F88-B3C3-52342FA25C90} = {227AEB37-EA4B-4ABD-929D-9E4A010BC30D} - {1790AB06-4AB8-47C0-8C68-798BCBD310FE} = {1FC7F5F3-77C7-464A-B571-5953242782D8} - {B51471DF-9B83-48F2-A705-5FB357A003C2} = {1FC7F5F3-77C7-464A-B571-5953242782D8} - {D90F08A6-5658-4DFE-A203-50B092CCD90F} = {0AF37317-F10E-47E8-A4C8-9EA886E00E40} - {32EA8BAC-5AF8-4310-BB0F-044C8A83ADEA} = {0AF37317-F10E-47E8-A4C8-9EA886E00E40} - {B76A68AA-2B92-48D9-809A-8BF56126A577} = {0AF37317-F10E-47E8-A4C8-9EA886E00E40} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0B0CD26D-8067-4667-863E-6B0EE7EDAA42} diff --git a/Src/RCommon.sln b/Src/RCommon.sln index ae9fd6d5..da708e4a 100644 --- a/Src/RCommon.sln +++ b/Src/RCommon.sln @@ -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 @@ -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 @@ -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} diff --git a/Tests/RCommon.ApplicationServices.Tests/Commands/CommandBusTests.cs b/Tests/RCommon.ApplicationServices.Tests/Commands/CommandBusTests.cs new file mode 100644 index 00000000..13adefe1 --- /dev/null +++ b/Tests/RCommon.ApplicationServices.Tests/Commands/CommandBusTests.cs @@ -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> mockLogger; + private Mock mockServiceProvider; + private Mock mockValidationService; + private Mock> mockOptionsCqrsValidationOptions; + private Mock> mockOptionsCachingOptions; + private Mock> mockCommonFactory; + + [SetUp] + public void SetUp() + { + this.mockRepository = new MockRepository(MockBehavior.Strict); + + this.mockLogger = this.mockRepository.Create>(); + this.mockServiceProvider = this.mockRepository.Create(); + this.mockValidationService = this.mockRepository.Create(); + this.mockOptionsCqrsValidationOptions = this.mockRepository.Create>(); + this.mockOptionsCachingOptions = this.mockRepository.Create>(); + this.mockCommonFactory = this.mockRepository.Create>(); + } + + 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(); + } + } +} diff --git a/Tests/RCommon.ApplicationServices.Tests/Queries/QueryBusTests.cs b/Tests/RCommon.ApplicationServices.Tests/Queries/QueryBusTests.cs new file mode 100644 index 00000000..b129647f --- /dev/null +++ b/Tests/RCommon.ApplicationServices.Tests/Queries/QueryBusTests.cs @@ -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> mockLogger; + private Mock mockServiceProvider; + private Mock mockValidationService; + private Mock> mockOptionsCqrsValidationOptions; + private Mock> mockOptionsCachingOptions; + private Mock> mockCommonFactory; + + [SetUp] + public void SetUp() + { + this.mockRepository = new MockRepository(MockBehavior.Strict); + + this.mockLogger = this.mockRepository.Create>(); + this.mockServiceProvider = this.mockRepository.Create(); + this.mockValidationService = this.mockRepository.Create(); + this.mockOptionsCqrsValidationOptions = this.mockRepository.Create>(); + this.mockOptionsCachingOptions = this.mockRepository.Create>(); + this.mockCommonFactory = this.mockRepository.Create>(); + } + + 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(); + } + } +} diff --git a/Tests/RCommon.ApplicationServices.Tests/Validation/ValidationOutcomeTests.cs b/Tests/RCommon.ApplicationServices.Tests/Validation/ValidationOutcomeTests.cs new file mode 100644 index 00000000..c4122819 --- /dev/null +++ b/Tests/RCommon.ApplicationServices.Tests/Validation/ValidationOutcomeTests.cs @@ -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(); + } + } +} diff --git a/Tests/RCommon.ApplicationServices.Tests/Validation/ValidationServiceTests.cs b/Tests/RCommon.ApplicationServices.Tests/Validation/ValidationServiceTests.cs new file mode 100644 index 00000000..a049085d --- /dev/null +++ b/Tests/RCommon.ApplicationServices.Tests/Validation/ValidationServiceTests.cs @@ -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 mockServiceProvider; + + [SetUp] + public void SetUp() + { + this.mockRepository = new MockRepository(MockBehavior.Strict); + + this.mockServiceProvider = this.mockRepository.Create(); + } + + 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(); + } + } +} diff --git a/Tests/RCommon.Core.Tests/Reflection/ObjectGraphWalkerTests.cs b/Tests/RCommon.Core.Tests/Reflection/ObjectGraphWalkerTests.cs new file mode 100644 index 00000000..5decbf53 --- /dev/null +++ b/Tests/RCommon.Core.Tests/Reflection/ObjectGraphWalkerTests.cs @@ -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(); + } + } +} diff --git a/Tests/RCommon.Core.Tests/SequentialGuidGeneratorTests.cs b/Tests/RCommon.Core.Tests/SequentialGuidGeneratorTests.cs new file mode 100644 index 00000000..48ced8dd --- /dev/null +++ b/Tests/RCommon.Core.Tests/SequentialGuidGeneratorTests.cs @@ -0,0 +1,60 @@ +using Microsoft.Extensions.Options; +using Moq; +using NUnit.Framework; +using RCommon; +using System; + +namespace RCommon.Core.Tests +{ + [TestFixture] + public class SequentialGuidGeneratorTests + { + private MockRepository mockRepository; + + private Mock> mockOptions; + + [SetUp] + public void SetUp() + { + this.mockRepository = new MockRepository(MockBehavior.Strict); + + this.mockOptions = this.mockRepository.Create>(); + } + + private SequentialGuidGenerator CreateSequentialGuidGenerator() + { + return new SequentialGuidGenerator( + this.mockOptions.Object); + } + + [Test] + public void Create_StateUnderTest_ExpectedBehavior() + { + // Arrange + var sequentialGuidGenerator = this.CreateSequentialGuidGenerator(); + + // Act + var result = sequentialGuidGenerator.Create(); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public void Create_StateUnderTest_ExpectedBehavior1() + { + // Arrange + var sequentialGuidGenerator = this.CreateSequentialGuidGenerator(); + SequentialGuidType guidType = default(global::RCommon.SequentialGuidType); + + // Act + var result = sequentialGuidGenerator.Create( + guidType); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + } +} diff --git a/Tests/RCommon.Core.Tests/SystemTimeTests.cs b/Tests/RCommon.Core.Tests/SystemTimeTests.cs new file mode 100644 index 00000000..004f53fe --- /dev/null +++ b/Tests/RCommon.Core.Tests/SystemTimeTests.cs @@ -0,0 +1,46 @@ +using Microsoft.Extensions.Options; +using Moq; +using NUnit.Framework; +using RCommon; +using System; + +namespace RCommon.Core.Tests +{ + [TestFixture] + public class SystemTimeTests + { + private MockRepository mockRepository; + + private Mock> mockOptions; + + [SetUp] + public void SetUp() + { + this.mockRepository = new MockRepository(MockBehavior.Strict); + + this.mockOptions = this.mockRepository.Create>(); + } + + private SystemTime CreateSystemTime() + { + return new SystemTime( + this.mockOptions.Object); + } + + [Test] + public void Normalize_StateUnderTest_ExpectedBehavior() + { + // Arrange + var systemTime = this.CreateSystemTime(); + DateTime dateTime = default(global::System.DateTime); + + // Act + var result = systemTime.Normalize( + dateTime); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + } +} diff --git a/Tests/RCommon.Dapper.Tests/Crud/DapperRepositoryTests.cs b/Tests/RCommon.Dapper.Tests/Crud/DapperRepositoryTests.cs new file mode 100644 index 00000000..8a112ccb --- /dev/null +++ b/Tests/RCommon.Dapper.Tests/Crud/DapperRepositoryTests.cs @@ -0,0 +1,260 @@ +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Moq; +using NUnit.Framework; +using RCommon; +using RCommon.Entities; +using RCommon.Persistence; +using RCommon.Persistence.Dapper.Crud; +using System; +using System.Threading.Tasks; + +namespace RCommon.Dapper.Tests.Crud +{ + [TestFixture] + public class DapperRepositoryTests + { + private MockRepository mockRepository; + + private Mock mockDataStoreFactory; + private Mock mockLoggerFactory; + private Mock mockEntityEventTracker; + private Mock> mockOptions; + + [SetUp] + public void SetUp() + { + this.mockRepository = new MockRepository(MockBehavior.Strict); + + this.mockDataStoreFactory = this.mockRepository.Create(); + this.mockLoggerFactory = this.mockRepository.Create(); + this.mockEntityEventTracker = this.mockRepository.Create(); + this.mockOptions = this.mockRepository.Create>(); + } + + private DapperRepository CreateDapperRepository() + { + return new DapperRepository( + this.mockDataStoreFactory.Object, + this.mockLoggerFactory.Object, + this.mockEntityEventTracker.Object, + this.mockOptions.Object); + } + + [Test] + public async Task AddAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var dapperRepository = this.CreateDapperRepository(); + TEntity entity = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + await dapperRepository.AddAsync( + entity, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task DeleteAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var dapperRepository = this.CreateDapperRepository(); + TEntity entity = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + await dapperRepository.DeleteAsync( + entity, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task UpdateAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var dapperRepository = this.CreateDapperRepository(); + TEntity entity = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + await dapperRepository.UpdateAsync( + entity, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var dapperRepository = this.CreateDapperRepository(); + ISpecification specification = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await dapperRepository.FindAsync( + specification, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindAsync_StateUnderTest_ExpectedBehavior1() + { + // Arrange + var dapperRepository = this.CreateDapperRepository(); + Expression expression = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await dapperRepository.FindAsync( + expression, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindAsync_StateUnderTest_ExpectedBehavior2() + { + // Arrange + var dapperRepository = this.CreateDapperRepository(); + object primaryKey = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await dapperRepository.FindAsync( + primaryKey, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task GetCountAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var dapperRepository = this.CreateDapperRepository(); + ISpecification selectSpec = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await dapperRepository.GetCountAsync( + selectSpec, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task GetCountAsync_StateUnderTest_ExpectedBehavior1() + { + // Arrange + var dapperRepository = this.CreateDapperRepository(); + Expression expression = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await dapperRepository.GetCountAsync( + expression, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindSingleOrDefaultAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var dapperRepository = this.CreateDapperRepository(); + Expression expression = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await dapperRepository.FindSingleOrDefaultAsync( + expression, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindSingleOrDefaultAsync_StateUnderTest_ExpectedBehavior1() + { + // Arrange + var dapperRepository = this.CreateDapperRepository(); + ISpecification specification = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await dapperRepository.FindSingleOrDefaultAsync( + specification, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task AnyAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var dapperRepository = this.CreateDapperRepository(); + Expression expression = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await dapperRepository.AnyAsync( + expression, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task AnyAsync_StateUnderTest_ExpectedBehavior1() + { + // Arrange + var dapperRepository = this.CreateDapperRepository(); + ISpecification specification = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await dapperRepository.AnyAsync( + specification, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + } +} diff --git a/Tests/RCommon.EFCore.Tests/Crud/EFCoreRepositoryTests.cs b/Tests/RCommon.EFCore.Tests/Crud/EFCoreRepositoryTests.cs new file mode 100644 index 00000000..5875e216 --- /dev/null +++ b/Tests/RCommon.EFCore.Tests/Crud/EFCoreRepositoryTests.cs @@ -0,0 +1,408 @@ +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Moq; +using NUnit.Framework; +using RCommon; +using RCommon.Entities; +using RCommon.Persistence; +using RCommon.Persistence.EFCore.Crud; +using System; +using System.Threading.Tasks; + +namespace RCommon.EFCore.Tests.Crud +{ + [TestFixture] + public class EFCoreRepositoryTests + { + private MockRepository mockRepository; + + private Mock mockDataStoreFactory; + private Mock mockLoggerFactory; + private Mock mockEntityEventTracker; + private Mock> mockOptions; + + [SetUp] + public void SetUp() + { + this.mockRepository = new MockRepository(MockBehavior.Strict); + + this.mockDataStoreFactory = this.mockRepository.Create(); + this.mockLoggerFactory = this.mockRepository.Create(); + this.mockEntityEventTracker = this.mockRepository.Create(); + this.mockOptions = this.mockRepository.Create>(); + } + + private EFCoreRepository CreateEFCoreRepository() + { + return new EFCoreRepository( + this.mockDataStoreFactory.Object, + this.mockLoggerFactory.Object, + this.mockEntityEventTracker.Object, + this.mockOptions.Object); + } + + [Test] + public void Include_StateUnderTest_ExpectedBehavior() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + Expression path = null; + + // Act + var result = eFCoreRepository.Include( + path); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public void ThenInclude_StateUnderTest_ExpectedBehavior() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + Expression path = null; + + // Act + var result = eFCoreRepository.ThenInclude( + path); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task AddAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + TEntity entity = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + await eFCoreRepository.AddAsync( + entity, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task DeleteAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + TEntity entity = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + await eFCoreRepository.DeleteAsync( + entity, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task UpdateAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + TEntity entity = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + await eFCoreRepository.UpdateAsync( + entity, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task GetCountAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + ISpecification selectSpec = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await eFCoreRepository.GetCountAsync( + selectSpec, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task GetCountAsync_StateUnderTest_ExpectedBehavior1() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + Expression expression = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await eFCoreRepository.GetCountAsync( + expression, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public void FindQuery_StateUnderTest_ExpectedBehavior() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + ISpecification specification = null; + + // Act + var result = eFCoreRepository.FindQuery( + specification); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public void FindQuery_StateUnderTest_ExpectedBehavior1() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + Expression expression = null; + + // Act + var result = eFCoreRepository.FindQuery( + expression); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + object primaryKey = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await eFCoreRepository.FindAsync( + primaryKey, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindAsync_StateUnderTest_ExpectedBehavior1() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + ISpecification specification = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await eFCoreRepository.FindAsync( + specification, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindAsync_StateUnderTest_ExpectedBehavior2() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + Expression expression = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await eFCoreRepository.FindAsync( + expression, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindAsync_StateUnderTest_ExpectedBehavior3() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + IPagedSpecification specification = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await eFCoreRepository.FindAsync( + specification, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindAsync_StateUnderTest_ExpectedBehavior4() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + Expression expression = null; + Expression orderByExpression = null; + bool orderByAscending = false; + int pageNumber = 0; + int pageSize = 0; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await eFCoreRepository.FindAsync( + expression, + orderByExpression, + orderByAscending, + pageNumber, + pageSize, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public void FindQuery_StateUnderTest_ExpectedBehavior2() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + Expression expression = null; + Expression orderByExpression = null; + bool orderByAscending = false; + int pageNumber = 0; + int pageSize = 0; + + // Act + var result = eFCoreRepository.FindQuery( + expression, + orderByExpression, + orderByAscending, + pageNumber, + pageSize); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public void FindQuery_StateUnderTest_ExpectedBehavior3() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + IPagedSpecification specification = null; + + // Act + var result = eFCoreRepository.FindQuery( + specification); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindSingleOrDefaultAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + Expression expression = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await eFCoreRepository.FindSingleOrDefaultAsync( + expression, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindSingleOrDefaultAsync_StateUnderTest_ExpectedBehavior1() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + ISpecification specification = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await eFCoreRepository.FindSingleOrDefaultAsync( + specification, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task AnyAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + Expression expression = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await eFCoreRepository.AnyAsync( + expression, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task AnyAsync_StateUnderTest_ExpectedBehavior1() + { + // Arrange + var eFCoreRepository = this.CreateEFCoreRepository(); + ISpecification specification = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await eFCoreRepository.AnyAsync( + specification, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + } +} diff --git a/Tests/RCommon.Linq2Db.Tests/Crud/Linq2DbRepositoryTests.cs b/Tests/RCommon.Linq2Db.Tests/Crud/Linq2DbRepositoryTests.cs new file mode 100644 index 00000000..8243c89c --- /dev/null +++ b/Tests/RCommon.Linq2Db.Tests/Crud/Linq2DbRepositoryTests.cs @@ -0,0 +1,408 @@ +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Moq; +using NUnit.Framework; +using RCommon; +using RCommon.Entities; +using RCommon.Persistence; +using RCommon.Persistence.Linq2Db.Crud; +using System; +using System.Threading.Tasks; + +namespace RCommon.Linq2Db.Tests.Crud +{ + [TestFixture] + public class Linq2DbRepositoryTests + { + private MockRepository mockRepository; + + private Mock mockDataStoreFactory; + private Mock mockLoggerFactory; + private Mock mockEntityEventTracker; + private Mock> mockOptions; + + [SetUp] + public void SetUp() + { + this.mockRepository = new MockRepository(MockBehavior.Strict); + + this.mockDataStoreFactory = this.mockRepository.Create(); + this.mockLoggerFactory = this.mockRepository.Create(); + this.mockEntityEventTracker = this.mockRepository.Create(); + this.mockOptions = this.mockRepository.Create>(); + } + + private Linq2DbRepository CreateLinq2DbRepository() + { + return new Linq2DbRepository( + this.mockDataStoreFactory.Object, + this.mockLoggerFactory.Object, + this.mockEntityEventTracker.Object, + this.mockOptions.Object); + } + + [Test] + public void Include_StateUnderTest_ExpectedBehavior() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + Expression path = null; + + // Act + var result = linq2DbRepository.Include( + path); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public void ThenInclude_StateUnderTest_ExpectedBehavior() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + Expression path = null; + + // Act + var result = linq2DbRepository.ThenInclude( + path); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task AddAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + TEntity entity = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + await linq2DbRepository.AddAsync( + entity, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task AnyAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + Expression expression = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await linq2DbRepository.AnyAsync( + expression, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task AnyAsync_StateUnderTest_ExpectedBehavior1() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + ISpecification specification = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await linq2DbRepository.AnyAsync( + specification, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task DeleteAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + TEntity entity = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + await linq2DbRepository.DeleteAsync( + entity, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public void FindQuery_StateUnderTest_ExpectedBehavior() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + ISpecification specification = null; + + // Act + var result = linq2DbRepository.FindQuery( + specification); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public void FindQuery_StateUnderTest_ExpectedBehavior1() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + Expression expression = null; + + // Act + var result = linq2DbRepository.FindQuery( + expression); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + object primaryKey = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await linq2DbRepository.FindAsync( + primaryKey, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindAsync_StateUnderTest_ExpectedBehavior1() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + ISpecification specification = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await linq2DbRepository.FindAsync( + specification, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindAsync_StateUnderTest_ExpectedBehavior2() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + Expression expression = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await linq2DbRepository.FindAsync( + expression, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindAsync_StateUnderTest_ExpectedBehavior3() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + IPagedSpecification specification = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await linq2DbRepository.FindAsync( + specification, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindAsync_StateUnderTest_ExpectedBehavior4() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + Expression expression = null; + Expression orderByExpression = null; + bool orderByAscending = false; + int pageNumber = 0; + int pageSize = 0; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await linq2DbRepository.FindAsync( + expression, + orderByExpression, + orderByAscending, + pageNumber, + pageSize, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public void FindQuery_StateUnderTest_ExpectedBehavior2() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + Expression expression = null; + Expression orderByExpression = null; + bool orderByAscending = false; + int pageNumber = 0; + int pageSize = 0; + + // Act + var result = linq2DbRepository.FindQuery( + expression, + orderByExpression, + orderByAscending, + pageNumber, + pageSize); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public void FindQuery_StateUnderTest_ExpectedBehavior3() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + IPagedSpecification specification = null; + + // Act + var result = linq2DbRepository.FindQuery( + specification); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindSingleOrDefaultAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + Expression expression = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await linq2DbRepository.FindSingleOrDefaultAsync( + expression, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task FindSingleOrDefaultAsync_StateUnderTest_ExpectedBehavior1() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + ISpecification specification = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await linq2DbRepository.FindSingleOrDefaultAsync( + specification, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task GetCountAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + ISpecification selectSpec = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await linq2DbRepository.GetCountAsync( + selectSpec, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task GetCountAsync_StateUnderTest_ExpectedBehavior1() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + Expression expression = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + var result = await linq2DbRepository.GetCountAsync( + expression, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task UpdateAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var linq2DbRepository = this.CreateLinq2DbRepository(); + TEntity entity = null; + CancellationToken token = default(global::System.Threading.CancellationToken); + + // Act + await linq2DbRepository.UpdateAsync( + entity, + token); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + } +} diff --git a/Tests/RCommon.Linq2Db.Tests/RCommonDataConnectionTests.cs b/Tests/RCommon.Linq2Db.Tests/RCommonDataConnectionTests.cs new file mode 100644 index 00000000..706b3d95 --- /dev/null +++ b/Tests/RCommon.Linq2Db.Tests/RCommonDataConnectionTests.cs @@ -0,0 +1,43 @@ +using LinqToDB; +using Moq; +using NUnit.Framework; +using RCommon.Persistence.Linq2Db; + +namespace RCommon.Linq2Db.Tests +{ + [TestFixture] + public class RCommonDataConnectionTests + { + private MockRepository mockRepository; + + private Mock mockDataOptions; + + [SetUp] + public void SetUp() + { + this.mockRepository = new MockRepository(MockBehavior.Strict); + + this.mockDataOptions = this.mockRepository.Create(); + } + + private RCommonDataConnection CreateRCommonDataConnection() + { + return new RCommonDataConnection( + this.mockDataOptions.Object); + } + + [Test] + public void GetDbConnection_StateUnderTest_ExpectedBehavior() + { + // Arrange + var rCommonDataConnection = this.CreateRCommonDataConnection(); + + // Act + var result = rCommonDataConnection.GetDbConnection(); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + } +} diff --git a/Tests/RCommon.MemoryCache.Tests/DistributedMemoryCacheServiceTests.cs b/Tests/RCommon.MemoryCache.Tests/DistributedMemoryCacheServiceTests.cs new file mode 100644 index 00000000..31deec76 --- /dev/null +++ b/Tests/RCommon.MemoryCache.Tests/DistributedMemoryCacheServiceTests.cs @@ -0,0 +1,71 @@ +using Microsoft.Extensions.Caching.Distributed; +using Moq; +using NUnit.Framework; +using RCommon.Json; +using RCommon.MemoryCache; +using System; +using System.Threading.Tasks; + +namespace RCommon.MemoryCache.Tests +{ + [TestFixture] + public class DistributedMemoryCacheServiceTests + { + private MockRepository mockRepository; + + private Mock mockDistributedCache; + private Mock mockJsonSerializer; + + [SetUp] + public void SetUp() + { + this.mockRepository = new MockRepository(MockBehavior.Strict); + + this.mockDistributedCache = this.mockRepository.Create(); + this.mockJsonSerializer = this.mockRepository.Create(); + } + + private DistributedMemoryCacheService CreateService() + { + return new DistributedMemoryCacheService( + this.mockDistributedCache.Object, + this.mockJsonSerializer.Object); + } + + [Test] + public void GetOrCreate_StateUnderTest_ExpectedBehavior() + { + // Arrange + var service = this.CreateService(); + object key = null; + Func data = null; + + // Act + var result = service.GetOrCreate( + key, + data); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task GetOrCreateAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var service = this.CreateService(); + object key = null; + Func data = null; + + // Act + var result = await service.GetOrCreateAsync( + key, + data); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + } +} diff --git a/Tests/RCommon.MemoryCache.Tests/InMemoryCacheServiceTests.cs b/Tests/RCommon.MemoryCache.Tests/InMemoryCacheServiceTests.cs new file mode 100644 index 00000000..19d30404 --- /dev/null +++ b/Tests/RCommon.MemoryCache.Tests/InMemoryCacheServiceTests.cs @@ -0,0 +1,67 @@ +using Microsoft.Extensions.Caching.Memory; +using Moq; +using NUnit.Framework; +using RCommon.MemoryCache; +using System; +using System.Threading.Tasks; + +namespace RCommon.MemoryCache.Tests +{ + [TestFixture] + public class InMemoryCacheServiceTests + { + private MockRepository mockRepository; + + private Mock mockMemoryCache; + + [SetUp] + public void SetUp() + { + this.mockRepository = new MockRepository(MockBehavior.Strict); + + this.mockMemoryCache = this.mockRepository.Create(); + } + + private InMemoryCacheService CreateService() + { + return new InMemoryCacheService( + this.mockMemoryCache.Object); + } + + [Test] + public void GetOrCreate_StateUnderTest_ExpectedBehavior() + { + // Arrange + var service = this.CreateService(); + object key = null; + Func data = null; + + // Act + var result = service.GetOrCreate( + key, + data); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public async Task GetOrCreateAsync_StateUnderTest_ExpectedBehavior() + { + // Arrange + var service = this.CreateService(); + object key = null; + Func data = null; + + // Act + var result = await service.GetOrCreateAsync( + key, + data); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + } +} diff --git a/Tests/RCommon.Persistence.Caching.Tests/GlobalUsings.cs b/Tests/RCommon.Persistence.Caching.Tests/GlobalUsings.cs new file mode 100644 index 00000000..cefced49 --- /dev/null +++ b/Tests/RCommon.Persistence.Caching.Tests/GlobalUsings.cs @@ -0,0 +1 @@ +global using NUnit.Framework; \ No newline at end of file diff --git a/Tests/RCommon.Persistence.Caching.Tests/RCommon.Persistence.Caching.Tests.csproj b/Tests/RCommon.Persistence.Caching.Tests/RCommon.Persistence.Caching.Tests.csproj new file mode 100644 index 00000000..4a6e827b --- /dev/null +++ b/Tests/RCommon.Persistence.Caching.Tests/RCommon.Persistence.Caching.Tests.csproj @@ -0,0 +1,28 @@ + + + + net8.0 + enable + enable + + false + true + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/Tests/RCommon.Persistence.Caching.Tests/UnitTest1.cs b/Tests/RCommon.Persistence.Caching.Tests/UnitTest1.cs new file mode 100644 index 00000000..c56af981 --- /dev/null +++ b/Tests/RCommon.Persistence.Caching.Tests/UnitTest1.cs @@ -0,0 +1,16 @@ +namespace RCommon.Persistence.Caching.Tests +{ + public class Tests + { + [SetUp] + public void Setup() + { + } + + [Test] + public void Test1() + { + Assert.Pass(); + } + } +} \ No newline at end of file diff --git a/Tests/RCommon.Persistence.Tests/DataStoreFactoryOptionsTests.cs b/Tests/RCommon.Persistence.Tests/DataStoreFactoryOptionsTests.cs new file mode 100644 index 00000000..6dbdcf3d --- /dev/null +++ b/Tests/RCommon.Persistence.Tests/DataStoreFactoryOptionsTests.cs @@ -0,0 +1,44 @@ +using Moq; +using NUnit.Framework; +using RCommon.Persistence; +using System; + +namespace RCommon.Persistence.Tests +{ + [TestFixture] + public class DataStoreFactoryOptionsTests + { + private MockRepository mockRepository; + + + + [SetUp] + public void SetUp() + { + this.mockRepository = new MockRepository(MockBehavior.Strict); + + + } + + private DataStoreFactoryOptions CreateDataStoreFactoryOptions() + { + return new DataStoreFactoryOptions(); + } + + [Test] + public void Register_StateUnderTest_ExpectedBehavior() + { + // Arrange + var dataStoreFactoryOptions = this.CreateDataStoreFactoryOptions(); + string name = null; + + // Act + dataStoreFactoryOptions.Register( + name); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + } +} diff --git a/Tests/RCommon.Persistence.Tests/DataStoreFactoryTests.cs b/Tests/RCommon.Persistence.Tests/DataStoreFactoryTests.cs new file mode 100644 index 00000000..a965ebc9 --- /dev/null +++ b/Tests/RCommon.Persistence.Tests/DataStoreFactoryTests.cs @@ -0,0 +1,65 @@ +using Microsoft.Extensions.Options; +using Moq; +using NUnit.Framework; +using RCommon.Persistence; +using System; + +namespace RCommon.Persistence.Tests +{ + [TestFixture] + public class DataStoreFactoryTests + { + private MockRepository mockRepository; + + private Mock mockServiceProvider; + private Mock> mockOptions; + + [SetUp] + public void SetUp() + { + this.mockRepository = new MockRepository(MockBehavior.Strict); + + this.mockServiceProvider = this.mockRepository.Create(); + this.mockOptions = this.mockRepository.Create>(); + } + + private DataStoreFactory CreateFactory() + { + return new DataStoreFactory( + this.mockServiceProvider.Object, + this.mockOptions.Object); + } + + [Test] + public void Resolve_StateUnderTest_ExpectedBehavior() + { + // Arrange + var factory = this.CreateFactory(); + string name = null; + + // Act + var result = factory.Resolve( + name); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public void Resolve_StateUnderTest_ExpectedBehavior1() + { + // Arrange + var factory = this.CreateFactory(); + string name = null; + + // Act + var result = factory.Resolve( + name); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + } +} diff --git a/Tests/RCommon.Persistence.Tests/DataStoreValueTests.cs b/Tests/RCommon.Persistence.Tests/DataStoreValueTests.cs new file mode 100644 index 00000000..d55d36dd --- /dev/null +++ b/Tests/RCommon.Persistence.Tests/DataStoreValueTests.cs @@ -0,0 +1,47 @@ +using Moq; +using NUnit.Framework; +using RCommon.Persistence; +using System; + +namespace RCommon.Persistence.Tests +{ + [TestFixture] + public class DataStoreValueTests + { + private MockRepository mockRepository; + + private Mock mockType; + private Mock mockType; + + [SetUp] + public void SetUp() + { + this.mockRepository = new MockRepository(MockBehavior.Strict); + + this.mockType = this.mockRepository.Create(); + this.mockType = this.mockRepository.Create(); + } + + private DataStoreValue CreateDataStoreValue() + { + return new DataStoreValue( + TODO, + this.mockType.Object, + this.mockType.Object); + } + + [Test] + public void TestMethod1() + { + // Arrange + var dataStoreValue = this.CreateDataStoreValue(); + + // Act + + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + } +} diff --git a/Tests/RCommon.Persistence.Tests/Transactions/UnitOfWorkFactoryTests.cs b/Tests/RCommon.Persistence.Tests/Transactions/UnitOfWorkFactoryTests.cs new file mode 100644 index 00000000..ec0036dd --- /dev/null +++ b/Tests/RCommon.Persistence.Tests/Transactions/UnitOfWorkFactoryTests.cs @@ -0,0 +1,81 @@ +using Moq; +using NUnit.Framework; +using RCommon; +using RCommon.Persistence.Transactions; +using System; + +namespace RCommon.Persistence.Tests.Transactions +{ + [TestFixture] + public class UnitOfWorkFactoryTests + { + private MockRepository mockRepository; + + private Mock mockServiceProvider; + private Mock mockGuidGenerator; + + [SetUp] + public void SetUp() + { + this.mockRepository = new MockRepository(MockBehavior.Strict); + + this.mockServiceProvider = this.mockRepository.Create(); + this.mockGuidGenerator = this.mockRepository.Create(); + } + + private UnitOfWorkFactory CreateFactory() + { + return new UnitOfWorkFactory( + this.mockServiceProvider.Object, + this.mockGuidGenerator.Object); + } + + [Test] + public void Create_StateUnderTest_ExpectedBehavior() + { + // Arrange + var factory = this.CreateFactory(); + + // Act + var result = factory.Create(); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public void Create_StateUnderTest_ExpectedBehavior1() + { + // Arrange + var factory = this.CreateFactory(); + TransactionMode transactionMode = default(global::RCommon.Persistence.Transactions.TransactionMode); + + // Act + var result = factory.Create( + transactionMode); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + + [Test] + public void Create_StateUnderTest_ExpectedBehavior2() + { + // Arrange + var factory = this.CreateFactory(); + TransactionMode transactionMode = default(global::RCommon.Persistence.Transactions.TransactionMode); + IsolationLevel isolationLevel = default(global::System.Transactions.IsolationLevel); + + // Act + var result = factory.Create( + transactionMode, + isolationLevel); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + } +} diff --git a/Tests/RCommon.Persistence.Tests/Transactions/UnitOfWorkSettingsTests.cs b/Tests/RCommon.Persistence.Tests/Transactions/UnitOfWorkSettingsTests.cs new file mode 100644 index 00000000..f82d559c --- /dev/null +++ b/Tests/RCommon.Persistence.Tests/Transactions/UnitOfWorkSettingsTests.cs @@ -0,0 +1,41 @@ +using Moq; +using NUnit.Framework; +using RCommon.Persistence.Transactions; + +namespace RCommon.Persistence.Tests.Transactions +{ + [TestFixture] + public class UnitOfWorkSettingsTests + { + private MockRepository mockRepository; + + + + [SetUp] + public void SetUp() + { + this.mockRepository = new MockRepository(MockBehavior.Strict); + + + } + + private UnitOfWorkSettings CreateUnitOfWorkSettings() + { + return new UnitOfWorkSettings(); + } + + [Test] + public void TestMethod1() + { + // Arrange + var unitOfWorkSettings = this.CreateUnitOfWorkSettings(); + + // Act + + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + } +} diff --git a/Tests/RCommon.Persistence.Tests/Transactions/UnitOfWorkTests.cs b/Tests/RCommon.Persistence.Tests/Transactions/UnitOfWorkTests.cs new file mode 100644 index 00000000..efb11d71 --- /dev/null +++ b/Tests/RCommon.Persistence.Tests/Transactions/UnitOfWorkTests.cs @@ -0,0 +1,51 @@ +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Moq; +using NUnit.Framework; +using RCommon; +using RCommon.Persistence.Transactions; + +namespace RCommon.Persistence.Tests.Transactions +{ + [TestFixture] + public class UnitOfWorkTests + { + private MockRepository mockRepository; + + private Mock> mockLogger; + private Mock mockGuidGenerator; + private Mock> mockOptions; + + [SetUp] + public void SetUp() + { + this.mockRepository = new MockRepository(MockBehavior.Strict); + + this.mockLogger = this.mockRepository.Create>(); + this.mockGuidGenerator = this.mockRepository.Create(); + this.mockOptions = this.mockRepository.Create>(); + } + + private UnitOfWork CreateUnitOfWork() + { + return new UnitOfWork( + this.mockLogger.Object, + this.mockGuidGenerator.Object, + this.mockOptions.Object); + } + + [Test] + public void Commit_StateUnderTest_ExpectedBehavior() + { + // Arrange + var unitOfWork = this.CreateUnitOfWork(); + + // Act + unitOfWork.Commit(); + + // Assert + Assert.Fail(); + this.mockRepository.VerifyAll(); + } + } +}