public void AuthorityPriorityIsRespected() { var higherAuthority = createContext.Add(new AuthorityEntity("Higher", defaultAuthority.Priority - 1, "higher")).Entity .ToAuthority(); var thePerson = CreateRepository(createContext).CreatePerson( new[] { Identifiers.NhsNumber("1234567890"), Identifiers.Address("22 Medway Street", postcode: "Will Be Replaced") }, defaultAuthority.ToAuthority()); createContext.SaveChanges(); var updatedAddress = Identifiers.Address("21 Spine Road", postcode: "Has Replaced"); CreateRepository(updateContext).UpdatePerson( (PersonIdentity)thePerson.Id, new[] { updatedAddress }, higherAuthority); updateContext.SaveChanges(); var newContext = CreateNewContextInSameTransaction(); CreateRepository(newContext).UpdatePerson( (PersonIdentity)thePerson.Id, new[] { Identifiers.Address(postcode: "Should Ignore This") }, defaultAuthority.ToAuthority() ); newContext.SaveChanges(); var identifiers = readContext.PersonIdentifiers.Where(_ => _.Person == thePerson && _.Deleted == null) .ToArray(); identifiers.Should().ContainSingleIdentifierValue(Identifiers.Definitions.NhsNumber, "1234567890") .And .ContainSingleIdentifierValue(updatedAddress); }