public void AddAlbumToInventory_InvalidModelState_ReturnsBadRequest()
        {
            _inventoryController.ModelState.AddModelError("Error", "Bad");

            var result = _inventoryController.AddAlbumToInventory(new AddAlbumViewModel());

            Assert.IsInstanceOfType(result, typeof(BadRequestErrorMessageResult));
        }
Пример #2
0
        public void AddAlbumToInventory_AddAlbumViewModel_AddsAlbumToDatabase()
        {
            var viewModel = new AddAlbumViewModel {
                Name = "Me"
            };

            _inventoryController.AddAlbumToInventory(viewModel);

            var albums = _context.Albums.ToList();

            const int expected = 1;

            Assert.AreEqual(expected, albums.Count);
        }