コード例 #1
0
        public async Task DeleteCoin_ReturnsNotFoundResponse_GivenInvalidCoinId()
        {
            //Act
            var response = await _controller.DeleteCoin(Guid.Empty);

            //Assert
            Assert.IsType <NotFoundResult>(response);
        }
コード例 #2
0
        public async Task TestDeleteSuccessfully()
        {
            using (var context = new CryptoCognizantContext(options))
            {
                CoinsController coinsController = new CoinsController(context, _mapper);

                ActionResult <IEnumerable <Coin> > result1 = await coinsController.GetCoin();

                ActionResult <Coin> delete = await coinsController.DeleteCoin(0);

                ActionResult <IEnumerable <Coin> > result2 = await coinsController.GetCoin();

                // Assert that coin list changes after coin is deleted
                Assert.AreNotEqual(result1, result2);
            }
        }