public async Task GivenANewResource_WhenUpserting_ThenTheVersionStartsAt1() { var saveResult = await FhirRepository.UpsertAsync(Samples.GetJsonSample("Weight")); Assert.Equal("1", saveResult.Resource.Meta.VersionId); saveResult = await FhirRepository.UpsertAsync(saveResult.Resource); Assert.Equal("2", saveResult.Resource.Meta.VersionId); }
public async Task GivenAFhirRepository_WhenSavingAResourceWithNoId_ThenAnIdShouldBeAssigned() { var resource = Samples.GetDefaultObservation(); resource.Id = null; _dataStore.UpsertAsync(Arg.Any <ResourceWrapper>(), Arg.Any <WeakETag>(), true, true) .Returns(x => new UpsertOutcome(x.ArgAt <ResourceWrapper>(0), SaveOutcomeType.Created)); await _repository.UpsertAsync(resource); Assert.NotNull(resource.Id); }