Exemplo n.º 1
0
        public void CombinedStrategy_AllEqual_NotASnap()
        {
            //Arrange
            var strategy = new CombinedStrategy();
            var card     = new Card(SuitEnum.Heart, FaceValueEnum.Ace);

            //Act
            var result = strategy.Snap(card, card);

            //Assert
            Assert.True(result);
        }
Exemplo n.º 2
0
        public void CombinedStrategy_SuitAndFaceValueDifferent_NotASnap()
        {
            //Arrange
            var strategy = new CombinedStrategy();
            var card1    = new Card(SuitEnum.Heart, FaceValueEnum.Ace);
            var card2    = new Card(SuitEnum.Spade, FaceValueEnum._5);

            //Act
            var result = strategy.Snap(card1, card2);

            //Assert
            Assert.False(result);
        }
Exemplo n.º 3
0
        public static CombinedStrategySettings GenerateExampleSettings()
        {
            CombinedStrategy.ForceLoad();

            var settings = new CombinedStrategySettings();

            var allComponents = AppDomain.CurrentDomain.GetAssemblies()
                                .SelectMany(a => a.GetTypes()
                                            .Where(type => type.IsClass &&
                                                   !type.IsAbstract &&
                                                   typeof(ITradingStrategyComponent).IsAssignableFrom(type) &&
                                                   !typeof(ITradingStrategy).IsAssignableFrom(type) &&
                                                   !type.IsInterface &&
                                                   !Attribute.IsDefined(type, typeof(DeprecatedStrategyAttribute))));


            settings.ComponentSettings = allComponents
                                         .OrderBy(t => t, new TradingStrategyComponentComparer())
                                         .Select(c => TradingStrategyComponentSettings.GenerateExampleSettings(
                                                     (ITradingStrategyComponent)Activator.CreateInstance(c)))
                                         .ToArray();

            return(settings);
        }
Exemplo n.º 4
0
        public CombinedStrategy NewStrategy()
        {
            var strategy = new CombinedStrategy(CreateComponents(), _allowRemovingInstructionRandomly);

            return(strategy);
        }