Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Add initial snapshot testing #567

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,6 @@ ASALocalRun/

# Test Results
/tests-results

# Snapshot testing
**/*.received.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
using System;
using System.Threading.Tasks;
using Enrolling.UnitTests.Builders;
using OpenCodeFoundation.ESchool.Services.Enrolling.Domain.AggregatesModel.EnrollmentAggregate;
using VerifyXunit;
using Xunit;

namespace Enrolling.UnitTests.Domain
{
[UsesVerify]
public class EnrollmentAggregateTests
{
[Fact]
public void NewApplicationShouldSuccessWithValidInput()
public Task NewApplicationShouldSuccessWithValidInput()
{
var dto = new EnrollmentDtoBuilder()
.WithDefaults()
.Build();

var enrollment = Enrollment.CreateNew(dto.Name!, dto.Email!, dto.Mobile!);

Assert.NotNull(enrollment);
Assert.Equal(dto.Name, enrollment.Name);
Assert.Equal(dto.Email, enrollment.EmailAddress);
Assert.Equal(dto.Mobile, enrollment.MobileNumber);
return Verifier.Verify(enrollment).UseDirectory("Snapshots");
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
Id: Guid_1,
Name: John Doe,
EmailAddress: john@example.com,
MobileNumber: 01771999999
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0"/>
<PackageReference Include="xunit" Version="2.4.1"/>
<PackageReference Include="Verify.Xunit" Version="16.5.4" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down