Пример #1
0
        public void GIVEN_close_collection_WHEN_close_THEN_obtain_exception()
        {
            Collection collection = CollectionFake.GetEmptyCollection();

            collection.CloseCollection();

            mockCollectionRepository.Setup(x => x.GetByIdAsync(It.IsAny <int>())).ReturnsAsync(collection);

            Assert.That(() => sut.CloseCollection(1), Throws.ArgumentException);
        }
        public async Task <IActionResult> CloseCollectionAsync(int id)
        {
            try
            {
                await collectionService.CloseCollection(id);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }