Beispiel #1
0
 public BettingSystemFixture()
 {
     Behaviors.OfType <ThrowingRecursionBehavior>().ToList()
     .ForEach(b => Behaviors.Remove(b));
     Behaviors.Add(new OmitOnRecursionBehavior());
     Customizations.Add(new PropertyNameOmitter("Id"));
 }
        public Explosion()
            : base("Explosion", new Vector2(32, 32))
        {
            Sprite.Animations.Add(new Animation("exploding", 0, 0, 1));
            Sprite.ChangeAnimation("exploding");
            var bh = Behaviors.OfType <PickableBehavior>().FirstOrDefault();

            Behaviors.Remove(bh);
        }
Beispiel #3
0
        public CustomAutoFixture()
        {
            Customize(new AutoNSubstituteCustomization
            {
                ConfigureMembers = true
            });

            Behaviors.OfType <ThrowingRecursionBehavior>()
            .ToList()
            .ForEach(b => Behaviors.Remove(b));

            Behaviors.Add(new OmitOnRecursionBehavior());
        }
Beispiel #4
0
        public void ReloadBehavior(BehaviorSave behavior)
        {
            string projectRootDirectory = FileManager.GetDirectory(this.FullFileName);

            var matchingReference = BehaviorReferences.FirstOrDefault(item => item.Name == behavior.Name);

            var newBehaviorSave = matchingReference?.ToBehaviorSave(projectRootDirectory);

            if (newBehaviorSave != null)
            {
                Behaviors.Remove(behavior);
                Behaviors.Add(newBehaviorSave);
            }
        }
Beispiel #5
0
 protected virtual void ToggleValidationBehavior()
 {
     if (Mandatory && Behaviors.Where(b => b is EntryMandatory).ToArray().Length == 0)
     {
         Behaviors.Add(new EntryMandatory());
     }
     else
     {
         var behavior = Behaviors.FirstOrDefault(b => b is EntryMandatory);
         if (behavior != null)
         {
             Behaviors.Remove(behavior);
         }
     }
 }
Beispiel #6
0
        public FixtureConstant()
        {
            Behaviors.Add(new OmitOnRecursionBehavior());
            var behavior = this.Behaviors.Single(b => typeof(ThrowingRecursionBehavior) == b.GetType());

            Behaviors.Remove(behavior);
            this.Freeze <string>();
            this.Freeze <int>();
            this.Freeze <bool>();
            this.Freeze <long>();
            this.Freeze <double>();
            this.Freeze <byte>();
            this.Freeze <DateTime>();
            this.Freeze <Guid>();
        }
Beispiel #7
0
        /* Start Threaded Events
         * This function selects all game events in the event stack defined to be threaded. If a game event is threaded,
         * it is then sent to a new thread to be executed on It's own.
         *
         * Threaded events are removed so they dont get rescheduled / re-ran on the main game loop.
         *
         * @no parameters
         * @return void
         */
        /// <summary>
        /// Schedule all to be threaded behaviors, and reschedule if they need refreshing.
        /// </summary>
        private void StartThreadedEvents()
        {
            // Grab all threaded game events
            var query = Behaviors.Where(b => b.Threaded);

            query.ToList().ForEach((b) =>
            {
                var task = new Task(b.Execute, TaskCreationOptions.LongRunning);
                // Start respective threads for each threaded game event.
                task.Start();
                // Add thread by name to the threads dictionary.
                Tasks.Add(b.Name, task);
                // Remove from event stack so no more threads are started
                Behaviors.Remove(b);
            });
        }
 public NoRecursionFixture()
 {
     Behaviors.OfType <ThrowingRecursionBehavior>().ToList().ForEach(b => Behaviors.Remove(b));
     Behaviors.Add(new OmitOnRecursionBehavior());
 }
 public OmitRecursionFixture()
 {
     Behaviors.Remove(new ThrowingRecursionBehavior());
     Behaviors.Add(new OmitOnRecursionBehavior());
 }