Ejemplo n.º 1
0
        public void T3()
        {
            // Arrange
            var tradeManager = new TradeManager();

            tradeManager.AddNewTrade(TestTradeDetailsViewModel);
            tradeManager.AddNewTrade(TestTradeDetailsViewModel);
            tradeManager.AddNewTrade(TestTradeDetailsViewModel);
            tradeManager.ClearAll();

            // Act
            var actual = tradeManager.GetDateRange();

            // Assert
            Assert.Equal((DateTime.MaxValue, DateTime.MinValue), actual);
        }
Ejemplo n.º 2
0
        public void T2()
        {
            // Arrange
            var tradeManager = new TradeManager();

            tradeManager.AddNewTrade(TestTradeDetailsViewModel);
            tradeManager.AddNewTrade(TestTradeDetailsViewModel);
            tradeManager.AddNewTrade(TestTradeDetailsViewModel);
            tradeManager.ClearAll();

            // Act
            tradeManager.FilterTrades(TestFilters);

            // Assert
            Assert.Empty(tradeManager.Trades);
        }
Ejemplo n.º 3
0
        public void T2()
        {
            // Arrange
            var tradeManager = new TradeManager {
                Filters = TestFilters
            };
            var tradeDetails = TestTradeDetailsViewModel;
            var testDate     = new DateTime(2021, 1, 2);

            tradeDetails.Open.Date = testDate;
            tradeManager.AddNewTrade(tradeDetails);
            tradeDetails.Open.Date = new DateTime(2021, 1, 3);

            // Act
            tradeManager.AddNewTrade(tradeDetails);

            // Assert
            Assert.Equal(testDate, tradeManager.GetDateRange().Item1);
        }
Ejemplo n.º 4
0
        public void T6()
        {
            // Arrange
            var tradeManager = new TradeManager {
                Filters = TestFilters
            };
            var tradeDetails = TestTradeDetailsViewModel;

            tradeDetails.Open.Date = new DateTime(2021, 1, 2);
            tradeManager.AddNewTrade(tradeDetails);
            var catcher = Catcher.Simple;

            tradeManager.DateRangeChanged += catcher.Catch;

            // Act
            tradeManager.AddNewTrade(tradeDetails);

            // Assert
            catcher.DidNotCatch();
        }
Ejemplo n.º 5
0
        public void T0()
        {
            // Arrange
            var tradeManager = new TradeManager {
                Filters = TestFilters
            };

            // Act
            tradeManager.AddNewTrade(TestTradeDetailsViewModel);

            // Assert
            Assert.NotEmpty(tradeManager.Trades);
        }
Ejemplo n.º 6
0
        public void T5()
        {
            // Arrange
            var tradeDetails = TestTradeDetailsViewModel;

            tradeDetails.CloseLevel = Option.None <double>();
            var tradeManager = new TradeManager {
                Filters = TestFilters
            };

            // Act
            tradeManager.AddNewTrade(tradeDetails);

            // Assert
            Assert.IsType <Option.OptionNone <Execution> >(tradeManager.Trades[0].Close);
        }
Ejemplo n.º 7
0
        public void T4()
        {
            // Arrange
            var          tradeDetails = TestTradeDetailsViewModel;
            const double testOpenSize = 19.6;

            tradeDetails.Open.Size = testOpenSize;
            var tradeManager = new TradeManager {
                Filters = TestFilters
            };

            // Act
            tradeManager.AddNewTrade(tradeDetails);

            // Assert
            Assert.Equal(testOpenSize, tradeManager.Trades[0].Open.Size);
        }
Ejemplo n.º 8
0
        public void T3()
        {
            // Arrange
            var          tradeDetails   = TestTradeDetailsViewModel;
            const double testLevelEntry = 123.00;

            tradeDetails.Levels.Entry = testLevelEntry;
            var tradeManager = new TradeManager {
                Filters = TestFilters
            };

            // Act
            tradeManager.AddNewTrade(tradeDetails);

            // Assert
            Assert.Equal(testLevelEntry, tradeManager.Trades[0].Levels.Entry);
        }
Ejemplo n.º 9
0
        public void T2()
        {
            // Arrange
            var tradeDetails = TestTradeDetailsViewModel;
            var testStrategy = new Strategy("Triangle");

            tradeDetails.SelectedStrategy = testStrategy;
            var tradeManager = new TradeManager {
                Filters = TestFilters
            };

            // Act
            tradeManager.AddNewTrade(tradeDetails);

            // Assert
            Assert.Equal(testStrategy, tradeManager.Trades[0].Strategy);
        }
Ejemplo n.º 10
0
        public void T1()
        {
            // Arrange
            var tradeDetails = TestTradeDetailsViewModel;
            var testMarket   = new Market("USDJPY", AssetClass.Currencies, PipDivisor.One);

            tradeDetails.SelectedMarket = testMarket;
            var tradeManager = new TradeManager {
                Filters = TestFilters
            };

            // Act
            tradeManager.AddNewTrade(tradeDetails);

            // Assert
            Assert.Equal(testMarket, tradeManager.Trades[0].Market);
        }
Ejemplo n.º 11
0
        public void T8()
        {
            // Arrange
            var          tradeDetails = TestTradeDetailsViewModel;
            const double testLow      = 93.8;

            tradeDetails.Low = Option.Some(testLow);
            var tradeManager = new TradeManager {
                Filters = TestFilters
            };
            var outValue = 1.00;

            // Act
            tradeManager.AddNewTrade(tradeDetails);

            // Assert
            tradeManager.Trades[0].Low.IfExistsThen(x => { outValue = x; });
            Assert.Equal(testLow, outValue);
        }
Ejemplo n.º 12
0
        public void T6()
        {
            // Arrange
            var          tradeDetails   = TestTradeDetailsViewModel;
            const double testCloseLevel = 456.78;

            tradeDetails.CloseLevel = Option.Some(testCloseLevel);
            var tradeManager = new TradeManager {
                Filters = TestFilters
            };
            var outValue = 1.00;

            // Act
            tradeManager.AddNewTrade(tradeDetails);

            // Assert
            tradeManager.Trades[0].Close.IfExistsThen(x => { outValue = x.Level; });
            Assert.Equal(testCloseLevel, outValue);
        }