private async Task ValidateUpdateCallBasedOnHttpMethodType(string httpMethodName) { if (httpMethodName == HttpPostName) { await _fhirDataStore.Received().UpdateSearchIndexForResourceAsync(Arg.Any <ResourceWrapper>(), Arg.Any <WeakETag>(), _cancellationToken); } else if (httpMethodName == HttpGetName) { await _fhirDataStore.DidNotReceive().UpdateSearchIndexForResourceAsync(Arg.Any <ResourceWrapper>(), Arg.Any <WeakETag>(), _cancellationToken); } }
public async Task GivenAFhirMediator_WhenDeletingAResourceThatIsAlreadyDeleted_ThenDoNothing() { var observation = Samples.GetDefaultObservation(); observation.Id = "id1"; observation.Meta = new Meta { VersionId = "version1", }; _fhirDataStore.GetAsync(Arg.Is <ResourceKey>(x => x.Id == "id1")).Returns(CreateResourceWrapper(observation, true)); ResourceKey resultKey = (await _mediator.DeleteResourceAsync(new ResourceKey <Observation>("id1"), false)).ResourceKey; await _fhirDataStore.DidNotReceive().UpsertAsync(Arg.Any <ResourceWrapper>(), Arg.Any <WeakETag>(), true, true); Assert.Equal(observation.Id, resultKey.Id); Assert.Equal(observation.Meta.VersionId, resultKey.VersionId); Assert.Equal("Observation", resultKey.ResourceType); }