Example #1
0
        public void TestMethodConvertListQuotationToJArray()
        {
            Quotation quotation = new Quotation(dateQuotation: new DateTime(2020, 12, 16),
                                                open: 3183.629883,
                                                high: 3197.709961,
                                                low: 3183.629883,
                                                close: 3191.449951,
                                                adjClose: 3191.449951);

            quotation.ChangeCurrencyToRub(72);
            List <Quotation> quotations = new List <Quotation>();

            quotations.Add(quotation);
            JArray jArray = Converter.ConvertListQuotationToJArray(quotations);

            JArray  jArrayMock  = new JArray();
            JObject jObjectMock = new JObject();

            jObjectMock["date"]     = "2020-12-16T00:00:00";
            jObjectMock["open"]     = 229221.35157600002;
            jObjectMock["high"]     = 230235.117192;
            jObjectMock["low"]      = 229221.35157600002;
            jObjectMock["close"]    = 229784.396472;
            jObjectMock["adjClose"] = 229784.396472;
            jArrayMock.Add(jObjectMock);
            Assert.AreEqual(jArrayMock.ToString(), jArray.ToString());
        }
Example #2
0
        public void TestMethodFinanceService()
        {
            Quotation quotationMock = new Quotation(dateQuotation: new DateTime(2019, 12, 16),
                                                    open: 229221.35157600002,
                                                    high: 230235.117192,
                                                    low: 229221.35157600002,
                                                    close: 229784.396472,
                                                    adjClose: 229784.396472);

            Quotation quotation = new Quotation(dateQuotation: new DateTime(2019, 12, 16),
                                                open: 3183.629883,
                                                high: 3197.709961,
                                                low: 3183.629883,
                                                close: 3191.449951,
                                                adjClose: 3191.449951);

            quotation.ChangeCurrencyToRub(72);
            Assert.AreEqual(quotationMock, quotation);
        }