Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKevJoy committed Apr 24, 2024
1 parent 324be9c commit c9e880a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class SetQTLSHandler(ICrmQueryDispatcher _crmQueryDispatcher)
}

var (induction, hasABInduction) = await GetInductionWithAppropriateBody(contact.Id);
if (!CanSetQTLSDate(contact.dfeta_QTSDate.HasValue, contact.dfeta_InductionStatus, induction?.dfeta_InductionStatus, hasABInduction, contact.dfeta_qtlsdate, command.QTSDate))
if (!CanSetQTLSDate(hasQTS: contact.dfeta_QTSDate.HasValue, overallInductionStatus: contact.dfeta_InductionStatus, inductionStatus: induction?.dfeta_InductionStatus, hasInductionWithAB: hasABInduction, existingQtlsdate: contact.dfeta_qtlsdate, incomingQtlsDate: command.QTSDate))
{
var _ = await _crmQueryDispatcher.ExecuteQuery(
new CreateReviewTaskQuery()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public async Task Put_ValidQTSDateWithNoExistingQTSDate_ReturnsExpectedResult()
// Act
var response = await GetHttpClientWithApiKey().SendAsync(request);
var contact = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Contact>().FirstOrDefault(x => x.ContactId == existingContact.PersonId);
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId == existingContact.ContactId.ToEntityReference(Contact.EntityLogicalName) && x.Subject == "Notification for SET QTLS data collections team");
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId.Id == existingContact.PersonId && x.Subject == "Notification for SET QTLS data collections team");

// Assert
await AssertEx.JsonResponseEquals(
Expand Down Expand Up @@ -368,7 +368,7 @@ public async Task Put_SetQTLSWhenInductionStatusIsInProgress_ReturnsStatusAccept
// Act
var response = await GetHttpClientWithApiKey().SendAsync(request);
var contact = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Contact>().FirstOrDefault(x => x.ContactId == existingContact.PersonId);
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault();
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId.Id == existingContact.PersonId && x.Subject == "Notification for SET QTLS data collections team");

// Assert
Assert.Equal(expectedInductionStatus, contact!.dfeta_InductionStatus);
Expand Down Expand Up @@ -417,7 +417,7 @@ public async Task Put_SetQTLSWhenInductionStatusIsNotYetCompleted_SetsInductionS
// Act
var response = await GetHttpClientWithApiKey().SendAsync(request);
var contact = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Contact>().FirstOrDefault(x => x.ContactId == existingContact.PersonId);
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId == existingContact.ContactId.ToEntityReference(Contact.EntityLogicalName) && x.Subject == "Notification for SET QTLS data collections team");
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId.Id == existingContact.PersonId && x.Subject == "Notification for SET QTLS data collections team");

// Assert
Assert.Null(task);
Expand Down Expand Up @@ -463,7 +463,7 @@ public async Task Put_ClearQTLSWhenInductionStatusIsNotYetCompleted_SetsInductio
// Act
var response = await GetHttpClientWithApiKey().SendAsync(request);
var contact = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Contact>().FirstOrDefault(x => x.ContactId == existingContact.PersonId);
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId == existingContact.ContactId.ToEntityReference(Contact.EntityLogicalName) && x.Subject == "Notification for SET QTLS data collections team");
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId.Id == existingContact.PersonId && x.Subject == "Notification for SET QTLS data collections team");

// Assert
Assert.Null(task);
Expand Down Expand Up @@ -508,7 +508,7 @@ public async Task Put_SetQTLSWhenInductionStatusIsInductionExtendedWithoutAB_Set
// Act
var response = await GetHttpClientWithApiKey().SendAsync(request);
var contact = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Contact>().FirstOrDefault(x => x.ContactId == existingContact.PersonId);
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId == existingContact.ContactId.ToEntityReference(Contact.EntityLogicalName) && x.Subject == "Notification for SET QTLS data collections team");
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId.Id == existingContact.PersonId && x.Subject == "Notification for SET QTLS data collections team");

// Assert
Assert.Null(task);
Expand Down Expand Up @@ -554,7 +554,7 @@ public async Task Put_ClearQTLSWhenInductionStatusIsInductionExtendedWithAB_Sets
// Act
var response = await GetHttpClientWithApiKey().SendAsync(request);
var contact = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Contact>().FirstOrDefault(x => x.ContactId == existingContact.PersonId);
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId == existingContact.ContactId.ToEntityReference(Contact.EntityLogicalName) && x.Subject == "Notification for SET QTLS data collections team");
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId.Id == existingContact.PersonId && x.Subject == "Notification for SET QTLS data collections team");

// Assert
Assert.Null(task);
Expand Down Expand Up @@ -598,7 +598,7 @@ public async Task Put_ClearQTLSWhenInductionStatusIsInductionExtendedWithAB_Sets
// Act
var response = await GetHttpClientWithApiKey().SendAsync(request);
var contact = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Contact>().FirstOrDefault(x => x.ContactId == existingContact.PersonId);
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId == existingContact.ContactId.ToEntityReference(Contact.EntityLogicalName) && x.Subject == "Notification for SET QTLS data collections team");
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId.Id == existingContact.PersonId && x.Subject == "Notification for SET QTLS data collections team");

// Assert
Assert.NotNull(task);
Expand Down Expand Up @@ -641,7 +641,7 @@ public async Task Put_SetQTLSWhenInductionStatusIsExempt_SetsInductionStatusExem
// Act
var response = await GetHttpClientWithApiKey().SendAsync(request);
var contact = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Contact>().FirstOrDefault(x => x.ContactId == existingContact.PersonId);
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId == existingContact.ContactId.ToEntityReference(Contact.EntityLogicalName) && x.Subject == "Notification for SET QTLS data collections team");
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId.Id == existingContact.PersonId && x.Subject == "Notification for SET QTLS data collections team");

// Assert
Assert.Null(task);
Expand Down Expand Up @@ -688,7 +688,7 @@ public async Task Put_ClearQTLSWhenInductionStatusIsExempt_SetsInductionStatusEx
// Act
var response = await GetHttpClientWithApiKey().SendAsync(request);
var contact = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Contact>().FirstOrDefault(x => x.ContactId == existingContact.PersonId);
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId == existingContact.ContactId.ToEntityReference(Contact.EntityLogicalName) && x.Subject == "Notification for SET QTLS data collections team");
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId.Id == existingContact.PersonId && x.Subject == "Notification for SET QTLS data collections team");

// Assert
Assert.Null(task);
Expand Down Expand Up @@ -733,7 +733,7 @@ public async Task Put_SetQTLSWhenInductionStatusIsPass_SetsInductionStatusPass()
// Act
var response = await GetHttpClientWithApiKey().SendAsync(request);
var contact = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Contact>().FirstOrDefault(x => x.ContactId == existingContact.PersonId);
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId == existingContact.ContactId.ToEntityReference(Contact.EntityLogicalName) && x.Subject == "Notification for SET QTLS data collections team");
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId.Id == existingContact.PersonId && x.Subject == "Notification for SET QTLS data collections team");

// Assert
Assert.Null(task);
Expand Down Expand Up @@ -780,7 +780,7 @@ public async Task Put_ClearQTLSWhenInductionStatusPass_SetsInductionStatusPass()
// Act
var response = await GetHttpClientWithApiKey().SendAsync(request);
var contact = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Contact>().FirstOrDefault(x => x.ContactId == existingContact.PersonId);
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId == existingContact.ContactId.ToEntityReference(Contact.EntityLogicalName) && x.Subject == "Notification for SET QTLS data collections team");
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId.Id == existingContact.PersonId && x.Subject == "Notification for SET QTLS data collections team");

// Assert
Assert.Null(task);
Expand Down Expand Up @@ -825,7 +825,7 @@ public async Task Put_SetQTLSWhenInductionStatusFail_ReturnsAccepted()
// Act
var response = await GetHttpClientWithApiKey().SendAsync(request);
var contact = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Contact>().FirstOrDefault(x => x.ContactId == existingContact.PersonId);
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId == existingContact.ContactId.ToEntityReference(Contact.EntityLogicalName) && x.Subject == "Notification for SET QTLS data collections team");
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId.Id == existingContact.PersonId && x.Subject == "Notification for SET QTLS data collections team");

// Assert
Assert.NotNull(task);
Expand Down Expand Up @@ -876,7 +876,7 @@ public async Task Put_ClearQTLSWhenInductionStatusFail_ReturnsAccepted()
// Act
var response = await GetHttpClientWithApiKey().SendAsync(request);
var contact = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Contact>().FirstOrDefault(x => x.ContactId == existingContact.PersonId);
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId == existingContact.ContactId.ToEntityReference(Contact.EntityLogicalName) && x.Subject == "Notification for SET QTLS data collections team");
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId.Id == existingContact.PersonId && x.Subject == "Notification for SET QTLS data collections team");

// Assert
Assert.NotNull(task);
Expand Down Expand Up @@ -925,7 +925,7 @@ public async Task Put_SetQTLSWhenInductionStatusIsPassedInWales_SetsInductionSta
// Act
var response = await GetHttpClientWithApiKey().SendAsync(request);
var contact = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Contact>().FirstOrDefault(x => x.ContactId == existingContact.PersonId);
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId == existingContact.ContactId.ToEntityReference(Contact.EntityLogicalName) && x.Subject == "Notification for SET QTLS data collections team");
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId.Id == existingContact.PersonId && x.Subject == "Notification for SET QTLS data collections team");

// Assert
Assert.Null(task);
Expand Down Expand Up @@ -972,7 +972,7 @@ public async Task Put_ClearQTLSWhenInductionStatusPassedInWales_SetsInductionSta
// Act
var response = await GetHttpClientWithApiKey().SendAsync(request);
var contact = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Contact>().FirstOrDefault(x => x.ContactId == existingContact.PersonId);
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId == existingContact.ContactId.ToEntityReference(Contact.EntityLogicalName) && x.Subject == "Notification for SET QTLS data collections team");
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId.Id == existingContact.PersonId && x.Subject == "Notification for SET QTLS data collections team");

// Assert
Assert.Null(task);
Expand Down Expand Up @@ -1017,7 +1017,7 @@ public async Task Put_SetQTLSWhenInductionStatusFailedInWales_ReturnsAccepted()
// Act
var response = await GetHttpClientWithApiKey().SendAsync(request);
var contact = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Contact>().FirstOrDefault(x => x.ContactId == existingContact.PersonId);
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId == existingContact.ContactId.ToEntityReference(Contact.EntityLogicalName) && x.Subject == "Notification for SET QTLS data collections team");
var task = XrmFakedContext.CreateQuery<TeachingRecordSystem.Core.Dqt.Models.Task>().FirstOrDefault(x => x.RegardingObjectId.Id == existingContact.PersonId && x.Subject == "Notification for SET QTLS data collections team");

// Assert
Assert.NotNull(task);
Expand Down

0 comments on commit c9e880a

Please sign in to comment.