示例#1
0
        public async Task TestDeleteSuccessfully()
        {
            using (var context = new CryptoCognizantContext(options))
            {
                ExchangesController exchangesController = new ExchangesController(context);

                ActionResult <IEnumerable <Exchange> > result1 = await exchangesController.GetExchange();

                ActionResult <Exchange> delete = await exchangesController.DeleteExchange(0);

                ActionResult <IEnumerable <Exchange> > result2 = await exchangesController.GetExchange();

                // Assert that exchange list changes after exchange is deleted
                Assert.AreNotEqual(result1, result2);
            }
        }
示例#2
0
        public async Task TestGetIDSuccessfully()
        {
            using (var context = new CryptoCognizantContext(options))
            {
                ExchangesController     exchangesController = new ExchangesController(context);
                ActionResult <Exchange> result = await exchangesController.GetExchange(0);

                Assert.IsNotNull(result);
            }
        }
示例#3
0
        public async Task TestPostSuccessfully()
        {
            using (var context = new CryptoCognizantContext(options))
            {
                ExchangesController exchangesController = new ExchangesController(context);

                Exchange exch = new Exchange()
                {
                    ExchangeId = 3,
                    Pairs      = "USD, USDT, NZD, AUD"
                };

                ActionResult <IEnumerable <Exchange> > result1 = await exchangesController.GetExchange();

                ActionResult <Exchange> post = await exchangesController.PostExchange(exch);

                ActionResult <IEnumerable <Exchange> > result2 = await exchangesController.GetExchange();

                // Assert that exchange list changes after new exchange is posted
                Assert.AreNotEqual(result1, result2);
            }
        }