From 15f191c0e16274e1c252e26200dc175c83366717 Mon Sep 17 00:00:00 2001 From: Martyn Whitwell Date: Thu, 9 Jan 2025 18:35:53 +0000 Subject: [PATCH] add broken test for ContactChannelCreation --- .../Services/CandidateUpserterTests.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/GetIntoTeachingApiTests/Services/CandidateUpserterTests.cs b/GetIntoTeachingApiTests/Services/CandidateUpserterTests.cs index 0f9154155..2389bb49d 100644 --- a/GetIntoTeachingApiTests/Services/CandidateUpserterTests.cs +++ b/GetIntoTeachingApiTests/Services/CandidateUpserterTests.cs @@ -264,6 +264,28 @@ public void Upsert_WhenPrivacyPolicyIsNull_DoesNotUpsertPrivacyPolicy() It.Is(job => job.Type == typeof(UpsertModelWithCandidateIdJob)), It.IsAny()), Times.Never); } + + // FIXME: This new test is broken and needs fixing + [Fact] + public void Upsert_WithContactChannelCreation_SavesContactChannelCreations() + { + var candidateId = Guid.NewGuid(); + var contactChannelCreation = new ContactChannelCreation { + CreationChannelActivityId = 222750000, + CreationChannelServiceId = 222750001, + CreationChannelSourceId = 222750002, + }; + + _candidate.ContactChannelCreations.Add(contactChannelCreation); + _mockCrm.Setup(mock => mock.Save(It.IsAny())).Callback(c => c.Id = candidateId); + + _upserter.Upsert(_candidate); + + contactChannelCreation.CandidateId = candidateId; + + _mockCrm.Verify(mock => mock.Save(It.Is(q => q.CandidateId == candidateId)), Times.Once); + } + private static bool IsMatch(object objectA, object objectB) {