Ejemplo n.º 1
0
        public void DeleteDiplomaReturnsDiploma()
        {
            //Arrange
            long doctorId  = 1;
            long diplomaId = doctorId + 1;

            diplomaRepository.Setup(d => d.Get(It.IsAny <object[]>())).ReturnsAsync((object[] key) =>
            {
                return(new Diploma
                {
                    Id = (long)key[0],
                    DoctorId = doctorId
                });
            });
            diplomaRepository.Setup(d => d.Delete(It.IsAny <object[]>())).ReturnsAsync((object[] key) =>
            {
                return(new Diploma
                {
                    Id = (long)key[0]
                });
            });

            //Act
            var result = (controller.DeleteDiploma(doctorId, diplomaId).Result as OkObjectResult).Value;

            //Assert
            Assert.IsInstanceOfType(result, typeof(Diploma));
            Assert.AreEqual(diplomaId, (result as Diploma)?.Id);
        }