public void Merge_Returns_Success_When_NoPriorImmunisation() { var patientId = 100; Immunisation immunisation = new Immunisation() { ImmunisationId = 10, }; var repository = new ImmunisationRepository(); repository.Add(patientId, immunisation); repository.Remove(patientId, 10); List <Immunisation> immunisationsToBeMerged = new List <Immunisation>() { new Immunisation() { ImmunisationId = 11 }, new Immunisation() { ImmunisationId = 12 } }; repository.Merge(patientId, immunisationsToBeMerged); Assert.IsNull(repository.Get(patientId, 10)); Assert.IsNotNull(repository.Get(patientId, 11)); Assert.IsNotNull(repository.Get(patientId, 12)); //Assert.ThrowsException<System.Data.Linq.DuplicateKeyException>(() => repository.Add(patientId, immunisation)); }
public void Merge_Returns_Success() { var patientId = 100; List <Immunisation> immunisations = new List <Immunisation>() { new Immunisation() { ImmunisationId = 10 }, new Immunisation() { ImmunisationId = 11 } }; var repository = new ImmunisationRepository(); repository.Add(patientId, new Immunisation() { ImmunisationId = 12 }); repository.Merge(patientId, immunisations); Assert.IsNotNull(repository.Get(patientId, 10)); Assert.IsNotNull(repository.Get(patientId, 11)); Assert.IsNotNull(repository.Get(patientId, 12)); }
public void Get_Returns_Exception_When_NullImmunisationId() { var patientId = 10; var immunisationId = 0; List <Immunisation> immunisations = new List <Immunisation>(); var repository = new ImmunisationRepository(); Assert.ThrowsException <ArgumentException>(() => repository.Get(patientId, immunisationId)); }
public void Get_Returns_Null_When_Not_Found() { var patientId = 100; var immunisationId = 10; var repository = new ImmunisationRepository(); var result = repository.Get(patientId, immunisationId); Assert.IsNull(result); }
public void Add_Returns_Success_When_EmptyImmunisation() { var patientId = 100; Immunisation immunisation = new Immunisation() { ImmunisationId = 10, }; var repository = new ImmunisationRepository(); repository.Add(patientId, immunisation); var returnImmunisation = repository.Get(patientId, immunisation.ImmunisationId); Assert.IsNotNull(returnImmunisation); }
public void Get_Returns_Success() { var patientId = 100; var immunisationId = 10; var repository = new ImmunisationRepository(); repository.Add(100, new Immunisation() { ImmunisationId = 10 }); var result = repository.Get(patientId, immunisationId); Assert.IsNotNull(result); }