Пример #1
0
        public async void TestDelete()
        {
            //Arrange
            var dto = new Entry
            {
                Name        = "DELETE TEST",
                PhoneNumber = "0833452693",
                PhoneBookId = 1,
            };

            _context.Add(dto);
            await _context.SaveChangesAsync();

            //Act
            var result = await _controller.DeleteEntry(dto.Id);

            var value = result.GetValue <OkObjectResult, Entry>();

            var check = _context.Entries
                        .FirstOrDefault(e => e.Id == value.Id);

            //Assert
            Assert.Null(check);
        }