Example #1
0
        public void DeletePositionReturnsDoctorPosition()
        {
            //Arrange
            long doctorId   = 1;
            long positionId = doctorId + 1;

            positionRepository.Setup(p => p.Exists(It.IsAny <object[]>())).ReturnsAsync(true);
            positionRepository.Setup(p => p.Delete(It.IsAny <object[]>())).ReturnsAsync((object[] id) =>
                                                                                        { return(new DoctorPosition {
                    Id = (long)id[0]
                }); });
            positionRepository.Setup(p => p.Get(It.IsAny <object[]>())).ReturnsAsync((object[] id) =>
                                                                                     { return(new DoctorPosition {
                    Id = (long)id[0], DoctorId = doctorId
                }); });

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

            //Assert
            Assert.IsInstanceOfType(result, typeof(DoctorPosition));
            Assert.AreEqual(positionId, (result as DoctorPosition)?.Id);
        }