コード例 #1
0
        public void Given_FeedbackRepository_When_DeletingAFeedback_Then_TheFeedbackShouldBeProperlyRemoved()
        {
            RunOnDatabase(async ctx => {
                //Arrange
                var repository = new FeedbackRepository(ctx);
                var feedback   = Feedback.Create("OK", null, null, 5);
                await repository.AddAsync(feedback);

                //Act
                await repository.DeleteAsync(feedback);

                //Assert
                Assert.AreEqual(repository.GetAllAsync().Result.Count, 0);
            });
        }
コード例 #2
0
        public void Given_FeedbackRepository_When_DeletingAFeedback_Then_TheFeedbackShouldBeProperlyRemoved()
        {
            RunOnDatabase(async ctx => {
                //Arrange
                var repository = new FeedbackRepository(ctx);
                var patient    = Patient.Create("1234", "Roland", "Iordache", "*****@*****.**", "asfdsdssd", "Iasi", "Romania", new DateTime(1996, 02, 10), "0746524459", null);
                var doctor     = Doctor.Create("1234", "Mircea", "Cartarescu", "*****@*****.**", "parola", "0746524459", "blasdadsadsada", "Cardiologie", "Sf. Spiridon", "Iasi", "Romania", "Str. Vasile Lupu", true);
                var feedback   = Feedback.Create("OK", patient.PatientId, doctor.DoctorId, 5, new DateTime());
                await repository.AddAsync(feedback);

                //Act
                await repository.DeleteAsync(feedback.FeedbackId);

                //Assert
                string[] includes = { };
                Assert.AreEqual(repository.GetAllAsync(includes).Result.Count, 1);
            });
        }