Пример #1
0
        public async Task ExchangeGetCreateTest()
        {
            // make sure get exchange api calls serve up the same instance
            var ex1 = await ExchangeAPI.GetExchangeAPIAsync <ExchangeGeminiAPI>();

            var ex2 = await ExchangeAPI.GetExchangeAPIAsync(ExchangeName.Gemini);

            Assert.AreSame(ex1, ex2);
            Assert.IsInstanceOfType(ex2, typeof(ExchangeGeminiAPI));

            // make sure create exchange serves up new instances
            var ex3 = await ExchangeAPI.CreateExchangeAPIAsync <ExchangeGeminiAPI>();

            Assert.AreNotSame(ex3, ex2);

            // make sure a bad exchange name throws correct exception
            await Assert.ThrowsExceptionAsync <ApplicationException>(() =>
            {
                return(ExchangeAPI.GetExchangeAPIAsync("SirExchangeNotAppearingInThisFilm"));
            });
        }