diff --git a/GetIntoTeachingApiTests/Services/CandidateUpserterTests.cs b/GetIntoTeachingApiTests/Services/CandidateUpserterTests.cs index 7a79e5d9c..0f9154155 100644 --- a/GetIntoTeachingApiTests/Services/CandidateUpserterTests.cs +++ b/GetIntoTeachingApiTests/Services/CandidateUpserterTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using FluentAssertions; using GetIntoTeachingApi.Jobs; using GetIntoTeachingApi.Services; @@ -8,8 +8,8 @@ using Moq; using Xunit; using GetIntoTeachingApi.Utils; -using GetIntoTeachingApi.Models.Crm; - +using GetIntoTeachingApi.Models.Crm; + namespace GetIntoTeachingApiTests.Services { public class CandidateUpserterTests @@ -99,11 +99,8 @@ public void Upsert_WithQualifications_SavesQualifications() _upserter.Upsert(_candidate); qualification.CandidateId = candidateId; - - _mockJobClient.Verify(x => x.Create( - It.Is(job => job.Type == typeof(UpsertModelWithCandidateIdJob) && job.Method.Name == "Run" && - IsMatch(qualification, (string)job.Args[0])), - It.IsAny())); + + _mockCrm.Verify(mock => mock.Save(It.Is(q => q.CandidateId == candidateId)), Times.Once); } [Fact] @@ -140,8 +137,8 @@ public void Upsert_WithApplicationForms_SavesApplicationForms() It.Is(job => job.Type == typeof(UpsertApplicationFormJob) && job.Method.Name == "Run" && IsMatch(applicationForm, (string)job.Args[0])), It.IsAny())); - } - + } + [Fact] public void Upsert_WithSchoolExperiences_SavesSchoolExperiences() { @@ -274,11 +271,11 @@ private static bool IsMatch(object objectA, object objectB) return true; } - private static bool IsMatch(T modelA, string modelBJson) + private static bool IsMatch(T modelA, string modelBJson) { - var candidateB = modelBJson.DeserializeChangeTracked(); - modelA.Should().BeEquivalentTo(candidateB); - return true; + var candidateB = modelBJson.DeserializeChangeTracked(); + modelA.Should().BeEquivalentTo(candidateB); + return true; } } }