Esempio n. 1
0
        public virtual void ShouldFailWithNotSupportedCaseException(bool A, bool B, bool C)
        {
            Input input = new Input {
                A = A, B = B, C = C
            };

            Assert.Throws <NotSupportedCaseException>(() => BaseFactory.Create(RuleType).GetOutput(input));
        }
Esempio n. 2
0
        public virtual void ShouldSelectCorrectLetter(bool A, bool B, bool C, HType expected)
        {
            Input input = new Input {
                A = A, B = B, C = C
            };
            Output output = BaseFactory.Create(RuleType).GetOutput(input);

            Assert.Equal(expected, output.H);
        }
Esempio n. 3
0
        public MainWindow()
        {
            InitializeComponent();
            InitializeUserInputActions();

            _gameSession = BaseFactory.Create <GameSessionFactory, GameSession>();

            _gameSession.OnMessageRaised += OnGameMessageRaised;
            DataContext = _gameSession;
        }
Esempio n. 4
0
 public ActionResult <object> Post([FromBody] Input input)
 {
     try
     {
         return(BaseFactory.Create(GetRuleType()).GetOutput(input));
     }
     catch (NotSupportedCaseException exc)
     {
         return(BadRequest(exc.ToError()));
     }
 }
Esempio n. 5
0
        public static void Main(string[] args)
        {
            Program p = BaseFactory.Create <ProgramFactory, Program>();

            p.foo = BaseFactory.Create <FooFactory, Foo>();

            p.foo.Name = "Hello World!!";
            Console.WriteLine(p.foo);

            p.foo.Name = "Bar";
            Console.WriteLine(p.foo);
        }
Esempio n. 6
0
        protected void ShouldCalculateK(Func <Input> getInput, float D, int E, int F, float expected)
        {
            Input input = getInput.Invoke();

            input.D = D;
            input.E = E;
            input.F = F;

            Output output = BaseFactory.Create(RuleType).GetOutput(input);

            Assert.Equal(expected, output.K);
        }
Esempio n. 7
0
        public GameSession()
        {
            CurrentWorld = WorldFactory.CreateWorld();

            CurrentPlayer = BaseFactory.Create <PlayerFactory, Player>("Daniel", "Fighter", 0, 10, 10, 1000000);

            if (!CurrentPlayer.Weapons.Any())
            {
                CurrentPlayer.AddItemToInventory(ItemFactory.CreateGameItem(1001));
            }

            CurrentPlayer.AddItemToInventory(ItemFactory.CreateGameItem(2001));
            CurrentPlayer.LearnRecipe(RecipeFactory.RecipeByID(1));
            CurrentPlayer.AddItemToInventory(ItemFactory.CreateGameItem(3001));
            CurrentPlayer.AddItemToInventory(ItemFactory.CreateGameItem(3002));
            CurrentPlayer.AddItemToInventory(ItemFactory.CreateGameItem(3003));

            CurrentLocation = CurrentWorld.LocationAt(0, 0);

            PropertyChanged += OnGamePropertyChanged;
            OnNewLocation   += OnNewLocation_CurrentLocation;
            OnNewMonster    += OnNewMonster_CurrentMonster;
        }