Exemple #1
0
 private static void BoxPostionsResults()
 {
     dataReader = DataFactory.GetDataFactory("CSV");
     DataSet dsData = dataReader.LoadData();
     var result = BoxPositionCalculator.Calculate(dsData);
     OutputCreator.Save(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "BoxPostion.csv"), result);
 }
        private static void BoxPostionsResults()
        {
            dataReader = DataFactory.GetDataFactory("CSV");
            DataSet dsData = dataReader.LoadData();
            var     result = BoxPositionCalculator.Calculate(dsData);

            OutputCreator.Save(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "BoxPostion.csv"), result);
        }
Exemple #3
0
        public void TestBoxPositionCalculator()
        {
            _dataReader = DataFactory.GetDataFactory("TestData");
            DataSet dsData = _dataReader.LoadData();
            var     result = BoxPositionCalculator.Calculate(dsData);

            Assert.That(result.Count, Is.EqualTo(2));
            Assert.That(result.Keys.First(), Is.EqualTo("Arya"));
            Assert.That(result["Arya"].Symbol[0].Symbol, Is.EqualTo("Rel"));
            Assert.That(result["Arya"].Symbol[0].Quantity, Is.EqualTo(20));

            Assert.That(result.Keys.Last(), Is.EqualTo("Misha"));
            Assert.That(result["Misha"].Symbol[0].Symbol, Is.EqualTo("PNB"));
            Assert.That(result["Misha"].Symbol[0].Quantity, Is.EqualTo(10));
        }
        public void TestBoxPositionCalculator()
        {
            _dataReader = DataFactory.GetDataFactory("TestData");
            DataSet dsData = _dataReader.LoadData();
            var result = BoxPositionCalculator.Calculate(dsData);

            Assert.That(result.Count, Is.EqualTo(2));
            Assert.That(result.Keys.First(), Is.EqualTo("Arya"));
            Assert.That(result["Arya"].Symbol[0].Symbol, Is.EqualTo("Rel"));
            Assert.That(result["Arya"].Symbol[0].Quantity, Is.EqualTo(20));

            Assert.That(result.Keys.Last(), Is.EqualTo("Misha"));
            Assert.That(result["Misha"].Symbol[0].Symbol, Is.EqualTo("PNB"));
            Assert.That(result["Misha"].Symbol[0].Quantity, Is.EqualTo(10));

        }
        public void TestNetPositionCalculator()
        {
            _dataReader = DataFactory.GetDataFactory("TestData");
            DataSet dsData = _dataReader.LoadData();
            var     result = NetPositionCalculator.Calculate(dsData);

            Assert.That(result.Count, Is.EqualTo(3));

            Assert.That(result.Keys.First(), Is.EqualTo("Anuj"));
            Assert.That(result["Anuj"].Symbol[0].Symbol, Is.EqualTo("SCI"));
            Assert.That(result["Anuj"].Symbol[0].Quantity, Is.EqualTo(120));

            Assert.That(result.Keys.Skip(1).Take(1).First(), Is.EqualTo("Arya"));
            Assert.That(result["Arya"].Symbol[0].Symbol, Is.EqualTo("Rel"));
            Assert.That(result["Arya"].Symbol[0].Quantity, Is.EqualTo(30));

            Assert.That(result.Keys.Last(), Is.EqualTo("Misha"));
            Assert.That(result["Misha"].Symbol[0].Symbol, Is.EqualTo("PNB"));
            Assert.That(result["Misha"].Symbol[0].Quantity, Is.EqualTo(-10));
        }