Skip to content

Commit 5943ecb

Browse files
committed
Initial Commit of Snapshot Testing
1 parent c46601a commit 5943ecb

File tree

5 files changed

+62
-2
lines changed

5 files changed

+62
-2
lines changed

application/CohortManager/src/Functions/Functions.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HealthChecks", "Shared\Heal
210210
EndProject
211211
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnumHelperTests", "..\..\..\..\tests\UnitTests\SharedTests\EnumHelperTests\EnumHelperTests.csproj", "{1FCC5D88-C291-46E0-84BE-A8FD465FD509}"
212212
EndProject
213+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "snapshot-tests", "..\..\..\..\tests\snapshot-tests\snapshot-tests.csproj", "{229B5903-6721-4F65-B086-6B3267666F2A}"
214+
EndProject
213215
Global
214216
GlobalSection(SolutionConfigurationPlatforms) = preSolution
215217
Debug|Any CPU = Debug|Any CPU
@@ -584,6 +586,10 @@ Global
584586
{1FCC5D88-C291-46E0-84BE-A8FD465FD509}.Debug|Any CPU.Build.0 = Debug|Any CPU
585587
{1FCC5D88-C291-46E0-84BE-A8FD465FD509}.Release|Any CPU.ActiveCfg = Release|Any CPU
586588
{1FCC5D88-C291-46E0-84BE-A8FD465FD509}.Release|Any CPU.Build.0 = Release|Any CPU
589+
{229B5903-6721-4F65-B086-6B3267666F2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
590+
{229B5903-6721-4F65-B086-6B3267666F2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
591+
{229B5903-6721-4F65-B086-6B3267666F2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
592+
{229B5903-6721-4F65-B086-6B3267666F2A}.Release|Any CPU.Build.0 = Release|Any CPU
587593
EndGlobalSection
588594
GlobalSection(SolutionProperties) = preSolution
589595
HideSolutionNode = FALSE

application/CohortManager/src/Functions/Shared/DataServices.Database/DataServicesContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class DataServicesContext : DbContext
1010
DbSet<LanguageCode> languageCodes { get; set; }
1111
DbSet<CurrentPosting> currentPostings { get; set; }
1212
DbSet<ExcludedSMULookup> excludedSMULookups { get; set; }
13-
DbSet<ExceptionManagement> exceptionManagements { get; set; }
13+
public DbSet<ExceptionManagement> exceptionManagements { get; set; }
1414
DbSet<GPPractice> gPPractices { get; set; }
1515
DbSet<BsSelectRequestAudit> bsSelectRequestAudits {get;set;}
1616

@@ -53,7 +53,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
5353

5454
modelBuilder.Entity<CohortDistribution>()
5555
.ToTable("BS_COHORT_DISTRIBUTION", "dbo");
56-
56+
5757
modelBuilder.Entity<BsSelectRequestAudit>()
5858
.ToTable("BS_SELECT_REQUEST_AUDIT","dbo");
5959

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
namespace NHS.CohortManager.Tests.SnapShotTests;
2+
3+
using System.Threading.Tasks;
4+
using DataServices.Database;
5+
using Microsoft.EntityFrameworkCore;
6+
using VerifyMSTest;
7+
8+
9+
[TestClass]
10+
public class AddFileTests : VerifyBase
11+
{
12+
private DataServicesContext _dbContext;
13+
[TestInitialize]
14+
public void Setup()
15+
{
16+
17+
var options = new DbContextOptionsBuilder<DataServicesContext>().UseSqlServer("").Options;
18+
_dbContext = new DataServicesContext(options);
19+
}
20+
[TestMethod]
21+
public async Task ValidateExceptionTable()
22+
{
23+
var Exceptions = await _dbContext.exceptionManagements.ToListAsync();
24+
await Verify(Exceptions);
25+
}
26+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)]
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<RootNamespace>snapshot_tests</RootNamespace>
6+
<LangVersion>latest</LangVersion>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.2" />
13+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
14+
<PackageReference Include="MSTest" Version="3.8.2" />
15+
<PackageReference Include="Verify.MSTest" Version="28.13.0" />
16+
</ItemGroup>
17+
18+
<ItemGroup>
19+
<ProjectReference Include="../../application/CohortManager/src/Functions/Shared/Common/Common.csproj" />
20+
<ProjectReference Include="../../application/CohortManager/src/Functions/Shared/DataServices.Database/DataServices.Database.csproj" />
21+
</ItemGroup>
22+
23+
<ItemGroup>
24+
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
25+
</ItemGroup>
26+
27+
</Project>

0 commit comments

Comments
 (0)