Ejemplo n.º 1
0
        public async Task EditAssett_NonExistingAsset_ReturnsNoContent()
        {
            // Arrange
            var assetForUpdate = new LibraryAssetForUpdateDto {
                Id = 4, Title = "Test", Year = 1992, NumberOfCopies = 10, AssetTypeId = 1, AuthorId = 2, CategoryId = 1
            };
            var asset = GetAsset();
            var mock  = new Mock <ILibraryAssetService>();

            mock.Setup(x => x.EditAsset(asset));
            var controller = new CatalogController(mock.Object, _logger, _mapper)
            {
                ControllerContext = SetClaimsUser()
            };

            // Act
            var result = await controller.EditAsset(assetForUpdate);

            // Assert
            Assert.IsType <BadRequestObjectResult>(result);
        }