public async Task ApprenticeshipStandardsPatchTest(MessageAction messageAction) { var elementId = Guid.NewGuid(); //Arrange var patchApprenticeshipStandardsModel = new PatchApprenticeshipStandardsModel() { ActionType = messageAction, Id = elementId }; currentOpportunitiesSegmentModel.Data.Apprenticeships = new Apprenticeships() { Standards = new List <Data.Models.ApprenticeshipStandard>(), }; currentOpportunitiesSegmentModel.Data.Apprenticeships.Standards.Add(new Data.Models.ApprenticeshipStandard() { Id = elementId }); A.CallTo(() => FakeRepository.UpsertAsync(A <CurrentOpportunitiesSegmentModel> .Ignored)).Returns(HttpStatusCode.OK); //Act var result = await CurrentOpportunitiesSegmentService.PatchApprenticeshipStandardsAsync(patchApprenticeshipStandardsModel, testGuid).ConfigureAwait(false); //Asserts A.CallTo(() => FakeCurrentOpportunitiesSegmentUtilities.GetReturnStatusForNullElementPatchRequest(A <MessageAction> .Ignored)).MustNotHaveHappened(); result.Should().Be(HttpStatusCode.OK); }
public async Task JobProfileSocPatchDeleteApprentishipNullTest() { //Arrange var patchJobProfileSocModel = new PatchJobProfileSocModel() { ActionType = MessageAction.Deleted }; A.CallTo(() => FakeCurrentOpportunitiesSegmentUtilities.GetReturnStatusForNullElementPatchRequest(A <MessageAction> .Ignored)).Returns(HttpStatusCode.AlreadyReported); //Act var result = await CurrentOpportunitiesSegmentService.PatchJobProfileSocAsync(patchJobProfileSocModel, testGuid).ConfigureAwait(false); //Asserts result.Should().Be(HttpStatusCode.AlreadyReported); }
public SegmentServicePatchTests() : base() { testGuid = Guid.NewGuid(); currentOpportunitiesSegmentPatchStatus = new CurrentOpportunitiesSegmentPatchStatus() { OkToPatch = true, ReturnStatusCode = HttpStatusCode.OK, }; A.CallTo(() => FakeCurrentOpportunitiesSegmentUtilities.IsSegementOkToPatch(A <CurrentOpportunitiesSegmentModel> .Ignored, A <long> .Ignored)).Returns(currentOpportunitiesSegmentPatchStatus); currentOpportunitiesSegmentModel = new CurrentOpportunitiesSegmentModel() { Data = new CurrentOpportunitiesSegmentDataModel() { }, }; A.CallTo(() => FakeRepository.GetAsync(A <Expression <Func <CurrentOpportunitiesSegmentModel, bool> > > .Ignored)).Returns(currentOpportunitiesSegmentModel); }
public async Task JobProfileSocPatchApprentishipTest(MessageAction messageAction) { //Arrange var patchJobProfileSocModel = new PatchJobProfileSocModel() { ActionType = messageAction }; currentOpportunitiesSegmentModel.Data.Apprenticeships = new Apprenticeships(); A.CallTo(() => FakeRepository.UpsertAsync(A <CurrentOpportunitiesSegmentModel> .Ignored)).Returns(HttpStatusCode.OK); //Act var result = await CurrentOpportunitiesSegmentService.PatchJobProfileSocAsync(patchJobProfileSocModel, testGuid).ConfigureAwait(false); //Asserts A.CallTo(() => FakeCurrentOpportunitiesSegmentUtilities.GetReturnStatusForNullElementPatchRequest(A <MessageAction> .Ignored)).MustNotHaveHappened(); result.Should().Be(HttpStatusCode.OK); }
public async Task JobProfileSocPatchSocReturnsNotFoundForMissingSegment() { //Arrange var doNotPatchResult = new CurrentOpportunitiesSegmentPatchStatus() { OkToPatch = false, ReturnStatusCode = HttpStatusCode.NotFound }; var patchJobProfileSocModel = new PatchJobProfileSocModel() { ActionType = MessageAction.Deleted }; A.CallTo(() => FakeRepository.GetAsync(A <Expression <Func <CurrentOpportunitiesSegmentModel, bool> > > .Ignored)).Returns(null as CurrentOpportunitiesSegmentModel); A.CallTo(() => FakeCurrentOpportunitiesSegmentUtilities.IsSegementOkToPatch(A <CurrentOpportunitiesSegmentModel> .Ignored, A <long> .Ignored)).Returns(doNotPatchResult); //Act var result = await CurrentOpportunitiesSegmentService.PatchJobProfileSocAsync(patchJobProfileSocModel, testGuid).ConfigureAwait(false); //Asserts result.Should().Be(HttpStatusCode.NotFound); }