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 Merge_Returns_Exception_When_NullPatientId()
        {
            var patientId = 0;
            List <Immunisation> immunisations = new List <Immunisation>();

            var repository = new ImmunisationRepository();

            Assert.ThrowsException <ArgumentException>(() => repository.Merge(patientId, immunisations));
        }
        public void Merge_Returns_DuplicateException()
        {
            var patientId = 100;
            List <Immunisation> immunisations = new List <Immunisation>()
            {
                new Immunisation()
                {
                    ImmunisationId = 10
                },
                new Immunisation()
                {
                    ImmunisationId = 10
                }
            };

            var repository = new ImmunisationRepository();

            repository.Add(patientId, new Immunisation()
            {
                ImmunisationId = 12
            });

            Assert.ThrowsException <System.Data.Linq.DuplicateKeyException>(() => repository.Merge(patientId, immunisations));
        }