public void TestStooq_CanImport_Single_Fail()
        {
            IQuotesSource source = CreateSource();

            IQuotesSourceCanImportParams canImportParams = source.CreateCanImportParams();

            canImportParams.Tickers.Add(ConfigurationManager.AppSettings["STOOQ_TICKER_INVALID"]);


            IQuotesSourceCanImportResult canImportResult = source.CanImport(canImportParams);

            Assert.IsNotNull(canImportResult);
            Assert.IsFalse(canImportResult.Success);
            Assert.False(canImportResult.HasErrors, "Unexpected error occured");
            Assert.IsNotNull(canImportResult.Tickers);
            Assert.AreEqual(canImportResult.Tickers.Count, 0, "Invalid number of tickers returned");
        }
        public void TestStooq_CanImport_Single_Success()
        {
            IQuotesSource source = CreateSource();

            IQuotesSourceCanImportParams canImportParams = source.CreateCanImportParams();

            canImportParams.Tickers.Add(ConfigurationManager.AppSettings["SEC_AAPL_CODE"]);


            IQuotesSourceCanImportResult canImportResult = source.CanImport(canImportParams);

            Assert.IsNotNull(canImportResult);
            Assert.IsTrue(canImportResult.Success);
            Assert.False(canImportResult.HasErrors, "Unexpected error occured");
            Assert.IsNotNull(canImportResult.Tickers);
            Assert.AreEqual(canImportResult.Tickers.Count, 1, "Invalid number of tickers returned");
            Assert.AreEqual(canImportResult.Tickers[0], ConfigurationManager.AppSettings["SEC_AAPL_CODE"], "Expected tickers were not returned");
        }
        public void TestStooq_CanImport_Multiple_PartialSuccess()
        {
            IQuotesSource source = CreateSource();

            IQuotesSourceCanImportParams canImportParams = source.CreateCanImportParams();

            canImportParams.Tickers.Add(ConfigurationManager.AppSettings["SEC_AAPL_CODE"]);
            canImportParams.Tickers.Add(ConfigurationManager.AppSettings["STOOQ_TICKER_INVALID"]);


            IQuotesSourceCanImportResult canImportResult = source.CanImport(canImportParams);

            Assert.IsNotNull(canImportResult);
            Assert.IsTrue(canImportResult.Success);
            Assert.False(canImportResult.HasErrors, "Unexpected error occured");
            Assert.IsNotNull(canImportResult.Tickers);
            Assert.AreEqual(canImportResult.Tickers.Count, 1, "Invalid number of tickers returned");
            Assert.Contains(ConfigurationManager.AppSettings["SEC_AAPL_CODE"], canImportResult.Tickers.ToArray(), "Expected ticker AAPL was not returned");
        }
示例#4
0
        public void TestCFTC_CanImport_Multiple_Success()
        {
            IQuotesSource source = CreateSource();

            IQuotesSourceCanImportParams canImportParams = source.CreateCanImportParams();

            canImportParams.Tickers.Add(ConfigurationManager.AppSettings["CFTC_TICKER_COT_FINFUT"]);
            canImportParams.Tickers.Add(ConfigurationManager.AppSettings["CFTC_TICKER_COT_FINFUTOPT"]);
            canImportParams.Tickers.Add(ConfigurationManager.AppSettings["CFTC_TICKER_COT_CMDTSFUT"]);
            canImportParams.Tickers.Add(ConfigurationManager.AppSettings["CFTC_TICKER_COT_CMDTSFUTOPT"]);


            IQuotesSourceCanImportResult canImportResult = source.CanImport(canImportParams);

            Assert.IsNotNull(canImportResult);
            Assert.IsTrue(canImportResult.Success);
            Assert.False(canImportResult.HasErrors, "Unexpected error occured");
            Assert.IsNotNull(canImportResult.Tickers);
            Assert.AreEqual(canImportResult.Tickers.Count, 4, "Invalid number of tickers returned");
        }