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 Remove_Return_Success() { var patientId = 100; var repository = new ImmunisationRepository(); repository.Add(patientId, new Immunisation() { ImmunisationId = 10, CreatedDate = DateTime.Now.AddDays(-30) }); repository.Remove(patientId, 10); var result = repository.GetTotal(patientId, DateTime.Now); Assert.AreEqual(0, result); }