-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
575969a
commit 62c3e03
Showing
10 changed files
with
123 additions
and
41 deletions.
There are no files selected for viewing
8 changes: 4 additions & 4 deletions
8
...es/Queries/GetMemberOfParliamentByConstituencies/GetMemberOfParliamentByConstituencies.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,16 +5,24 @@ namespace Dfe.Academies.Testing.Common.Customizations.Models | |
{ | ||
public class AcademyGovernanceCustomization : ICustomization | ||
{ | ||
public string? FirstName { get; set; } = "John"; | ||
public string? LastName { get; set; } = "Doe"; | ||
public string? Email { get; set; } = "[email protected]"; | ||
public string? DisplayName { get; set; } = "John Doe"; | ||
public string? DisplayNameWithTitle { get; set; } = "Mr. John Doe"; | ||
public List<string> Roles { get; set; } = ["MP"]; | ||
public DateTime UpdatedAt { get; set; } = DateTime.Now; | ||
|
||
public void Customize(IFixture fixture) | ||
{ | ||
fixture.Customize<AcademyGovernance>(composer => composer | ||
.With(x => x.FirstName, "John") | ||
.With(x => x.LastName, "Doe") | ||
.With(x => x.Email, "[email protected]") | ||
.With(x => x.DisplayName, "John Doe") | ||
.With(x => x.DisplayNameWithTitle, "Mr. John Doe") | ||
.With(x => x.Roles, new List<string> { "MP" }) | ||
.With(x => x.UpdatedAt, DateTime.Now)); | ||
.With(x => x.FirstName, FirstName) | ||
.With(x => x.LastName, LastName) | ||
.With(x => x.Email, Email) | ||
.With(x => x.DisplayName, DisplayName) | ||
.With(x => x.DisplayNameWithTitle, DisplayNameWithTitle) | ||
.With(x => x.Roles, Roles) | ||
.With(x => x.UpdatedAt, UpdatedAt)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,17 +5,26 @@ namespace Dfe.Academies.Testing.Common.Customizations.Models | |
{ | ||
public class MemberOfParliamentCustomization : ICustomization | ||
{ | ||
public string? ConstituencyName { get; set; } | ||
public string? FirstName { get; set; } | ||
public string? LastName { get; set; } | ||
public string? Email { get; set; } | ||
public string? DisplayName { get; set; } | ||
public string? DisplayNameWithTitle { get; set; } | ||
public List<string>? Roles { get; set; } | ||
public DateTime? UpdatedAt { get; set; } | ||
|
||
public void Customize(IFixture fixture) | ||
{ | ||
fixture.Customize<MemberOfParliament>(composer => composer | ||
.With(x => x.ConstituencyName, "ExampleConstituency") | ||
.With(x => x.FirstName, "John") | ||
.With(x => x.LastName, "Doe") | ||
.With(x => x.Email, "[email protected]") | ||
.With(x => x.DisplayName, "John Doe") | ||
.With(x => x.DisplayNameWithTitle, "Mr. John Doe") | ||
.With(x => x.Roles, new List<string> { "MP" }) | ||
.With(x => x.UpdatedAt, DateTime.Now)); | ||
.With(x => x.ConstituencyName, ConstituencyName ?? fixture.Create<string>()) | ||
.With(x => x.FirstName, FirstName ?? fixture.Create<string>()) | ||
.With(x => x.LastName, LastName ?? fixture.Create<string>()) | ||
.With(x => x.Email, Email ?? fixture.Create<string>()) | ||
.With(x => x.DisplayName, DisplayName ?? fixture.Create<string>()) | ||
.With(x => x.DisplayNameWithTitle, DisplayNameWithTitle ?? fixture.Create<string>()) | ||
.With(x => x.Roles, Roles ?? fixture.Create<List<string>>()) | ||
.With(x => x.UpdatedAt, UpdatedAt ?? fixture.Create<DateTime>())); | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
Tests/Dfe.Academies.Testing.Common/Customizations/OmitCircularReferenceCustomization.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using AutoFixture; | ||
|
||
namespace Dfe.Academies.Testing.Common.Customizations | ||
{ | ||
public class OmitCircularReferenceCustomization : ICustomization | ||
{ | ||
public void Customize(IFixture fixture) | ||
{ | ||
fixture.Behaviors.OfType<ThrowingRecursionBehavior>().ToList() | ||
.ForEach(b => fixture.Behaviors.Remove(b)); | ||
|
||
fixture.Behaviors.Add(new OmitOnRecursionBehavior()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters