Example #1
0
        public void Given_BloodBankRepository_When_AddAsyncingABloodBank_Then_TheBloodBankShouldBeProperlySaved()
        {
            RunOnDatabase(async ctx => {
                //Arrange
                var repository = new BloodBankRepository(ctx);
                var doctor     = Doctor.Create("Daniel", "Oana", "*****@*****.**", "parola", "0746524459", "bla", "Cardiologie", "Sf. Spiridon", "Iasi", "Str. Vasile Lupu");
                var bloodBank  = BloodBank.Create(doctor);
                //Act
                await repository.AddAsync(bloodBank);

                //Assert
                Assert.AreEqual(repository.GetAllAsync().Result.Count, 1);
            });
        }
Example #2
0
        public void Given_BloodBankRepository_When_ReturningABloodBank_Then_TheBloodBankShouldBeProperlyReturned()
        {
            RunOnDatabase(async ctx => {
                //Arrange
                var repository = new BloodBankRepository(ctx);
                var doctor     = Doctor.Create("Daniel", "Oana", "*****@*****.**", "parola", "0746524459", "bla", "Cardiologie", "Sf. Spiridon", "Iasi", "Str. Vasile Lupu");
                var bloodBank  = BloodBank.Create(doctor);
                await repository.AddAsync(bloodBank);

                //Act
                var extractedBloodBank = await repository.GetByIdAsync(bloodBank.BloodBankId);

                //Assert
                Assert.AreEqual(bloodBank, extractedBloodBank);
            });
        }
Example #3
0
        public void Given_BloodBankRepository_When_EditingABloodBank_Then_TheBloodBankShouldBeProperlyEdited()
        {
            RunOnDatabase(async ctx => {
                //Arrange
                var repository = new BloodBankRepository(ctx);
                var doctor     = Doctor.Create("Daniel", "Oana", "*****@*****.**", "parola", "0746524459", "bla", "Cardiologie", "Sf. Spiridon", "Iasi", "Str. Vasile Lupu");
                var bloodBank  = BloodBank.Create(doctor);
                await repository.AddAsync(bloodBank);

                //var firstName = doctor.FirstName;

                bloodBank.Update("A2", doctor);

                //var newFirstName = doctor.FirstName;

                //Act
                await repository.UpdateAsync(bloodBank);

                //Assert
                Assert.AreEqual(repository.GetAllAsync().Result[0].Types["A2"], 1);
            });
        }