Esempio n. 1
0
        public void LastPriceFxDataIsInvertedWhenNecessary()
        {
            var inst = new Instrument {
                Symbol = "USD.CAD", ID = 1, AssetCategory = AssetClass.Cash
            };
            var startDate = new DateTime(2000, 1, 1);

            var fxrSetStub = new DbSetStub <FXRate>();

            fxrSetStub.Add(new FXRate {
                FromCurrencyID = 2, ToCurrencyID = 1, Date = startDate, Rate = 1.1m
            });

            var currencySetStub = new DbSetStub <Currency>();

            currencySetStub.Add(new Currency {
                ID = 2, Name = "CAD"
            });

            _contextMock.Setup(x => x.Currencies).Returns(currencySetStub);
            _contextMock.Setup(x => x.FXRates).Returns(fxrSetStub);

            decimal fxRate;
            var     price = _datasourcer.GetLastPrice(inst, out fxRate);

            Assert.AreEqual(1m / 1.1m, price);
        }
Esempio n. 2
0
        public void LastPriceFxDataIsInvertedWhenNecessary()
        {
            var inst = new Instrument {
                Symbol = "USD.CAD", ID = 1, AssetCategory = AssetClass.Cash
            };
            var startDate = new DateTime(2000, 1, 1);

            _data.FXRates.Add(new FXRate {
                FromCurrencyID = 2, ToCurrencyID = 1, Date = startDate, Rate = 1.1m
            });

            _data.Currencies.Add(new Currency {
                ID = 2, Name = "CAD"
            });

            decimal fxRate;
            var     price = _datasourcer.GetLastPrice(inst, out fxRate);

            Assert.AreEqual(1m / 1.1m, price);
        }