public void PutTechnology_Negative_ReturnsBadRequest() { var dataRepo = new Mock <IDatabaseRepository>(); Technology technology = null; dataRepo.Setup(d => d.UpdateTechnology(technology)).Returns(technology); SMEController sMEController = new SMEController(dataRepo.Object); var actionResult = sMEController.Put(new Technology()); Assert.IsType <NotFoundObjectResult>(actionResult); }
public void PutTechnology_Positive_ReturnsUpdatedObject() { var dataRepo = new Mock <IDatabaseRepository>(); Technology technology = new Technology { Name = "Java", Topics = new List <Topic>() }; dataRepo.Setup(d => d.UpdateTechnology(technology)).Returns(technology); SMEController sMEController = new SMEController(dataRepo.Object); var actionResult = sMEController.Put(technology); Assert.NotNull(actionResult); var createdResult = actionResult as CreatedResult; Assert.NotNull(createdResult); var model = createdResult.Value as Technology; Assert.NotNull(model); }