Exemple #1
0
        public async Task Removing_many_items_Should_return_not_found_result_If_EmptyStorageException_is_thrown()
        {
            var contextWithData = CreateContextWithData(10);
            var controller      = new StorageItemController(new DataRepository(contextWithData));
            var result          = await controller.RemoveMany(new List <StorageItem>()
            {
                new StorageItem("Ost")
                {
                    ItemAmount = 11
                }
            }) as BadRequestObjectResult;

            Assert.AreEqual(400, result?.StatusCode);
            await contextWithData.Database.EnsureDeletedAsync();
        }
Exemple #2
0
        public async Task Removing_many_items_Should_return_no_content_result()
        {
            var contextWithData = CreateContextWithData(10);
            var controller      = new StorageItemController(new DataRepository(contextWithData));
            var result          = await controller.RemoveMany(new List <StorageItem>()
            {
                new StorageItem("Ost")
                {
                    ItemAmount = 1
                }
            }) as NoContentResult;

            Assert.AreEqual(204, result?.StatusCode);
            await contextWithData.Database.EnsureDeletedAsync();
        }