Beispiel #1
0
        public async void TestPut()
        {
            //Arrange
            var dto = new Entry
            {
                Name        = "PUT TEST",
                PhoneNumber = "0833452693",
                PhoneBookId = 1,
            };

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

            dto.Name        = "PUT TEST(2)";
            dto.PhoneNumber = "0833452693(2)";

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

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

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

            //Assert
            Assert.NotNull(value);
            Assert.NotEqual(0, value.Id);
            Assert.NotEqual("PUT TEST", check.Name);
            Assert.NotEqual("0833452693", check.PhoneNumber);
        }