public void Add_Fail() { var service = GetMockedAnimalService(); service.Setup(x => x.Add(It.IsAny <AnimalContract>())).Returns(new OperationResult(false, "Fail")); var controller = new AnimalsController(service.Object); var result = (OperationResult)controller.Add(new AnimalContract()).Data; Assert.IsFalse(result.Success); Assert.IsNotEmpty(result.Message); }