Exemplo n.º 1
0
        public void DeleteReturnsNotFound()
        {
            // Arrange
            var mockRepository = new Mock <IKategorijaProizvodaRepository>();
            var controller     = new KategorijeController(mockRepository.Object);

            // Act
            IHttpActionResult actionResult = controller.Delete(10);

            // Assert
            Assert.IsInstanceOfType(actionResult, typeof(NotFoundResult));
        }
Exemplo n.º 2
0
        public void DeleteReturnsOk()
        {
            // Arrange
            var mockRepository = new Mock <IKategorijaProizvodaRepository>();

            mockRepository.Setup(x => x.GetById(10)).Returns(new KategorijaProizvoda {
                Id = 10
            });
            var controller = new KategorijeController(mockRepository.Object);

            // Act
            IHttpActionResult actionResult = controller.Delete(10);

            // Assert
            Assert.IsInstanceOfType(actionResult, typeof(OkResult));
        }