Example #1
0
        public void Delete()
        {
            var test = Insert();

            _testRepository.Delete(test);
            _unitOfWork.SaveChanges();

            var newTest = _testRepository.GetAll().FirstOrDefault(x => x.Id == test.Id);

            Assert.True(newTest == null);
        }
 public bool DeleteTest(DeleteTestModel model)
 {
     _testRepository.Delete(new TestThu {
         Id = model.Id
     });
     return(true);
 }
Example #3
0
        public async Task <MessageResponse> DeleteTestAsync(int testId)
        {
            await _testRepository.Delete(testId);

            await _unitOfWork.CompleteAsync();

            return(new MessageResponse(true, "Test deleted successfully"));
        }
 /// <summary>
 /// Remove existing Test.
 /// </summary>
 /// <param name="test"> Test to remove.</param>
 public void DeleteTest(BllTest test)
 {
     if (test == null)
     {
         throw new ArgumentNullException(nameof(test));
     }
     repository.Delete(test.ToDalTest());
     service.Save();
 }
Example #5
0
 public void DeleteTest(TestEntity test)
 {
     if (test == null)
     {
         throw new ArgumentNullException();
     }
     repo.Delete(test.Id);
     uow.Save();
 }
Example #6
0
 public HttpResponseMessage Delete(int id)
 {
     try
     {
         _dbRepository.Delete(id);
         return(Request.CreateResponse(HttpStatusCode.OK));
     }
     catch (Exception)
     {
         return(Request.CreateResponse(HttpStatusCode.BadRequest));
     }
 }
Example #7
0
        public IActionResult DeleteTest(long id)
        {
            Test test = test_repo.Find(id);

            if (test == null)
            {
                return(NotFound());
            }

            test_repo.Delete(test);
            return(Ok());
        }
Example #8
0
        public async Task <DeletedTestDto> DeleteTest(int testId)
        {
            Test test = await testRepository.GetByIdAsync(testId);

            if (test == null)
            {
                return(null);
            }

            testRepository.Delete(test);
            await unitOfWork.SaveAsync();

            return(mapper.Map <DeletedTestDto>(test));
        }
    public void Can_Delete_Entity()
    {
        // Arrange
        var entity = new TestEntity("A", "B", "C", true);

        _connection.AddResultForDataReader(cmd => cmd.CommandText == "DELETE...",
                                           new[] { new TestEntity("A1", "B1", "C1", true) }); //suffixes get ignored because Delete does not read result

        // Act
        var actual = _repository.Delete(entity);

        // Assert
        actual.Code.Should().Be(entity.Code);
        actual.CodeType.Should().Be(entity.CodeType);
        actual.Description.Should().Be(entity.Description);
        actual.IsExistingEntity.Should().BeTrue();
    }
Example #10
0
 public bool Delete(Guid id)
 {
     return(_testRepository.Delete(id));
 }
Example #11
0
 public async Task <bool> Delete(Guid id)
 {
     return(await _testRepository.Delete(id));
 }
Example #12
0
 public void DeleteTest(TestEntity e)
 {
     testRepository.Delete(e.ToDalTest());
     uow.Commit();
 }
Example #13
0
 public IActionResult Delete(int id)
 {
     _testRepository.Delete(id);
     return(Ok());
 }
Example #14
0
 public int Delete(int id)
 {
     return(repository.Delete(id));
 }
Example #15
0
 /// <summary>
 /// Removes a test
 /// </summary>
 /// <param name="entity">Test</param>
 public void Delete(BllTest entity)
 {
     testRepository.Delete(entity.ToDalTest());
     DeleteTestQuestions(entity.Id);
     unitOfWork.Commit();
 }
Example #16
0
 public IActionResult DeleteConfirmed(int id)
 {
     _testRepository.Delete(id);
     return(RedirectToAction("Index", "Home"));
 }
Example #17
0
 public async Task Delete(int testId)
 {
     await _testRepository.Delete(testId);
 }