Пример #1
0
        public void DeleteReturnsDoctorSpecialty()
        {
            //Arrange
            long id = 1;

            specialtyRepository.Setup(s => s.Exists(It.IsAny <long>(), It.IsAny <int>())).ReturnsAsync(
                new DoctorSpecialty {
                Id = id
            });
            specialtyRepository.Setup(s => s.Delete(It.IsAny <object[]>())).ReturnsAsync(
                (object[] key) => { return(new DoctorSpecialty {
                    Id = (long)key[0]
                }); });

            //Act
            var result = (controller.DeleteSpecialty(1, 2).Result as OkObjectResult).Value;

            //Assert
            Assert.IsInstanceOfType(result, typeof(DoctorSpecialty));
            Assert.AreEqual(id, (result as DoctorSpecialty)?.Id);
        }