Beispiel #1
0
        public async Task GrabNzbFromCartAsync_Returns_Not_Found_With_Invalid_Entry()
        {
            var req = TestHelper.CreateHttpRequest("https://nzb.mtighe.dev/api/cart/nzb/123");

            _cartTable.SetupOperationToFail(TableOperationType.Retrieve);
            _authService.Setup(s => s.IsAuthenticated(req)).ReturnsAsync(true);

            var result = await _function.GrabNzbFromCartAsync(req, _cartTable.Object, _log.Object, "123");

            Assert.IsType <NotFoundResult>(result);
        }
        public async Task ExecuteAsync_Throws_An_Exception_If_The_Wish_Doesnt_Exist()
        {
            _table.SetupOperationToFail(TableOperationType.Retrieve);

            var cmd = new ToggleWishCommand("123", true);
            var ex  = await Record.ExceptionAsync(() => cmd.ExecuteAsync(_table.Object));

            _table.VerifyFailedOperation(TableOperationType.Retrieve);
            Assert.NotNull(ex);
            Assert.Equal("Wish id 123 does not exist.", ex.Message);
        }