Esempio n. 1
0
        static void Main(string[] args)
        {
            var agent = new Agent();
            var lair = new Lair();
            var dice = new Dice(m => new Random(DateTime.Now.Millisecond).Next(100));
            var mission = new InfiltrationMission(dice);

            var timer = new MissionTimer(new LocatorImp());
            timer.Subscribe(mission);

            //wire up the mission complete event
            mission.AsObservable<MissionOutcome>()
                .Subscribe(outcome =>
                               {
                                   Console.WriteLine("Mission complete");
                                   mission.Begin(agent, lair);
                               });

            mission.Begin(agent, lair);
            Console.ReadLine();
        }
 public void Should_evaluate_to_true_if_less_than_equal(int randomResult, decimal maxTrue)
 {
     var dice = new Dice(m => randomResult);
     Assert.IsTrue(dice.RollPercentage(maxTrue));
 }
 public void Should_evaluate_to_false_if_greater_than(int randomResult, int maxTrue)
 {
     var dice = new Dice(m => randomResult);
     Assert.IsFalse(dice.RollPercentage(maxTrue));
 }