Beispiel #1
0
        public void AddCat_ShouldCallAddCatOnRepo()
        {
            // Arrange
            repositoryMock.Setup(x => x.AddCat(It.IsAny <Cat>())).Verifiable();

            // Act
            catService.AddCat(new Cat());

            // Assert
            repositoryMock.Verify(x => x.AddCat(It.IsAny <Cat>()), Times.Once);
            //Assert.IsTrue(true); ==> NO HACER ESTO, PORQUE MUERE UN GATITO BEBE
        }
 public ActionResult Post([FromBody] RequestModel cat)
 {
     _catService.AddCat(cat);
     return(StatusCode(StatusCodes.Status201Created, $"The cat fact has been created."));
 }
Beispiel #3
0
        public IActionResult Create(CatViewModel model)
        {
            _catService.AddCat(model);

            return(Redirect("/"));
        }