Esempio n. 1
0
        private void addCrowdChildrenLabeledByOrderToChildCrowd(CrowdRepository repo, string nestedChildName,
                                                                Crowd parent)
        {
            var count = 0;

            foreach (var child in StandardizedFixture.CreateMany <Crowd>().ToList())
            {
                child.Name = nestedChildName + "." + count;
                count++;
                child.Order = count;
                repo.Crowds.Add(child);
                parent.AddCrowdMember(child);
            }
        }
Esempio n. 2
0
        private void addChildCrowdsLabeledByOrder(CrowdRepository repo)
        {
            repo.Crowds = new ObservableCollection <Crowd>((StandardizedFixture.CreateMany <Crowd>()));
            var counter = "0";
            var count   = 0;

            foreach (var c in repo.Crowds)
            {
                c.Name  = counter + "." + count;
                c.Order = count;
                count++;
                c.CrowdRepository = repo;
            }
        }
        private void setupStandardizedFixture()
        {
            //all core dependencies use mock objects
            //StandardizedFixture = new Fixture();
            StandardizedFixture.Inject(MockPosition);
            StandardizedFixture.Inject(MockKeybindGenerator);
            StandardizedFixture.Inject(MockDesktopCharacterTargeter);
            StandardizedFixture.Inject(MockMemoryInstance);
            StandardizedFixture.Inject(MockCamera);
            StandardizedFixture.Inject(MockCharacterProgressBarStats);
            StandardizedFixture.Inject(MockActionGroup);

            //map interfaces to classes
            StandardizedFixture.Customizations.Add(
                new TypeRelay(
                    typeof(DesktopCharacterTargeter),
                    typeof(DesktopCharacterTargeterImpl)));
            StandardizedFixture.Customizations.Add(
                new TypeRelay(
                    typeof(DesktopCharacterTargeter),
                    typeof(DesktopCharacterTargeterImpl)));
            StandardizedFixture.Customizations.Add(
                new TypeRelay(
                    typeof(DesktopMemoryCharacter),
                    typeof(DesktopMemoryCharacterImpl)));
            StandardizedFixture.Customizations.Add(
                new TypeRelay(
                    typeof(ManagedCharacter),
                    typeof(ManagedCharacterImpl)));
            StandardizedFixture.Customizations.Add(
                new TypeRelay(
                    typeof(CharacterActionList <Identity>),
                    typeof(CharacterActionListImpl <Identity>)));
            StandardizedFixture.Customizations.Add(
                new TypeRelay(
                    typeof(Identity),
                    typeof(IdentityImpl)));
            StandardizedFixture.Customizations.Add(
                new TypeRelay(
                    typeof(CharacterActionContainer),
                    typeof(ManagedCharacterImpl)));

            StandardizedFixture.Customize <IdentityImpl>(i => i
                                                         .Without(x => x.AnimationOnLoad));
            StandardizedFixture.Customize <ManagedCharacterImpl>(i => i
                                                                 .Without(x => x.GhostShadow));
            //handle recursion
            StandardizedFixture.Behaviors.Add(new OmitOnRecursionBehavior());
        }
Esempio n. 4
0
        private void addCharacterChildrenLabeledByOrderToChildCrowd(CrowdRepository repo, string nestedName,
                                                                    Crowd parent)
        {
            var count = 0;

            foreach (var grandchild in StandardizedFixture.CreateMany <CharacterCrowdMember>().ToList())
            {
                grandchild.Name = nestedName + "." + count;
                grandchild.CharacterActionGroups = GetStandardCharacterActionGroup(grandchild);
                count++;
                grandchild.Order = count;
                //repo.AllMembersCrowd.AddCrowdMember(grandchild);
                parent.AddCrowdMember(grandchild);
            }
        }
Esempio n. 5
0
 public AttackTestObjectsFactory()
 {
     StandardizedFixture.Customizations.Add(
         new TypeRelay(
             typeof(AnimatedCharacter),
             typeof(AnimatedCharacterImpl)));
     StandardizedFixture.Customizations.Add(
         new TypeRelay(
             typeof(AnimatedAttack),
             typeof(AnimatedAttackImpl)));
     StandardizedFixture.Customizations.Add(
         new TypeRelay(
             typeof(MultiAttack),
             typeof(MultiAttackImpl)));
     StandardizedFixture.Customizations.Add(
         new TypeRelay(
             typeof(GangAttack),
             typeof(GangAttackImpl)));
     StandardizedFixture.Customizations.Add(
         new TypeRelay(
             typeof(GangAreaAttack),
             typeof(GangAreaAttackImpl)));
     StandardizedFixture.Customizations.Add(
         new TypeRelay(
             typeof(AttackInstructions),
             typeof(AttackInstructionsImpl)));
     StandardizedFixture.Customizations.Add(
         new TypeRelay(
             typeof(MultiAttackInstructions),
             typeof(MultiAttackInstructionsImpl)));
     StandardizedFixture.Customizations.Add(
         new TypeRelay(
             typeof(GangAttackInstructions),
             typeof(GangAttackInstructionsImpl)));
     StandardizedFixture.Customizations.Add(
         new TypeRelay(
             typeof(GangAreaAttackInstructions),
             typeof(GangAreaAttackInstructionsImpl)));
     StandardizedFixture.Customize <AttackInstructionsImpl>(ai => ai
                                                            .Without(x => x.Defender));
     StandardizedFixture.Customize <MultiAttackInstructionsImpl>(ai => ai
                                                                 .Without(x => x.Defender));
     StandardizedFixture.Customize <GangAttackInstructionsImpl>(ai => ai
                                                                .Without(x => x.Defender));
     StandardizedFixture.Customize <GangAreaAttackInstructionsImpl>(ai => ai
                                                                    .Without(x => x.Defender));
     DefaultAbilities.DefaultCharacter = DefenderUnderTestWithMockDefaultAbilities;
 }
Esempio n. 6
0
        private void setupFixtureToBuildCrowdRepositories()
        {
            //setup repository with dependencies that have cicruclar ref back to repo removed
            StandardizedFixture.Customize <CrowdRepositoryImpl>(c => c
                                                                .Without(x => x.NewCrowdInstance)
                                                                .Without(x => x.NewCharacterCrowdMemberInstance)
                                                                .Without(x => x.Crowds)
                                                                .With(x => x.UsingDependencyInjection, false)
                                                                );

            StandardizedFixture.Customize <CrowdImpl>(c => c
                                                      .Without(x => x.AllCrowdMembershipParents)
                                                      .Without(x => x.MemberShips)
                                                      //.With(x => x.Members, new ObservableCollection<HeroVirtualTabletop.Crowd.CrowdMember>())
                                                      .Without(x => x.Members)
                                                      );

            StandardizedFixture.Customize <CharacterCrowdMemberImpl>(c => c
                                                                     .Without(x => x.AllCrowdMembershipParents)
                                                                     .Without(x => x.DesktopNavigator)
                                                                     .Without(x => x.CharacterActionGroups)
                                                                     );

            var crowds = StandardizedFixture.CreateMany <Crowd>().ToList();

            //now setup repo again with dependencies included.
            //the dependencies are now referring to a parent repo
            //with no refefrence to these dependencies so circular ref is broken
            StandardizedFixture.Customize <CrowdRepositoryImpl>(c => c
                                                                .With(x => x.NewCrowdInstance, StandardizedFixture.Create <Crowd>())
                                                                .With(x => x.NewCharacterCrowdMemberInstance, StandardizedFixture.Create <CharacterCrowdMember>())
                                                                //also add the crowds previously created
                                                                .Do(x => crowds.ForEach(t => x.Crowds.Add(t)))
                                                                );

            //create a repo based on above config ie the dependencies with circular ref removed
            var repo = StandardizedFixture.Create <CrowdRepositoryImpl>();

            //add the the circular ref back to the repo to the dependencies
            //AUTOFIXTURE AND CIRC DEPENDECIES SUCK!!!
            repo.NewCrowdInstance.CrowdRepository = repo;
            repo.NewCharacterCrowdMemberInstance.CrowdRepository = repo;

            StandardizedFixture.Inject <CrowdRepository>(repo);
        }
Esempio n. 7
0
        public void AddCrowdwMemberHierarchyWithTwoParentsANdFourChildrenEach(CrowdRepository repo, out Crowd parent0,
                                                                              out Crowd parent1, out CharacterCrowdMember child0_0, out CharacterCrowdMember child0_1,
                                                                              out CharacterCrowdMember child0_2, out CharacterCrowdMember child0_3, out CharacterCrowdMember child1_0,
                                                                              out CharacterCrowdMember child1_1, out CharacterCrowdMember child1_2, out CharacterCrowdMember child1_3)
        {
            parent0      = StandardizedFixture.Create <CrowdImpl>();
            parent0.Name = "Parent0";
            parent1      = StandardizedFixture.Create <CrowdImpl>();
            parent1.Name = "Parent1";
            repo.Crowds.Add(parent0);
            repo.Crowds.Add(parent1);

            AddChildCrowdMemberToParent(repo, parent0, out child0_0, "child0_0");
            AddChildCrowdMemberToParent(repo, parent0, out child0_1, "child0_1");
            AddChildCrowdMemberToParent(repo, parent0, out child0_2, "child0_2");
            AddChildCrowdMemberToParent(repo, parent0, out child0_3, "child0_3");

            AddChildCrowdMemberToParent(repo, parent1, out child1_0, "child1_0");
            AddChildCrowdMemberToParent(repo, parent1, out child1_1, "child1_1");
            AddChildCrowdMemberToParent(repo, parent1, out child1_2, "child1_2");
            AddChildCrowdMemberToParent(repo, parent1, out child1_3, "child1_3");
        }
Esempio n. 8
0
        public MovableCharacterTestObjectFactory()
        {
            StandardizedFixture.Customizations.Add(
                new TypeRelay(
                    typeof(MovementMember),
                    typeof(MovementMemberImpl)));
            StandardizedFixture.Customizations.Add(
                new TypeRelay(
                    typeof(Movement),
                    typeof(MovementImpl)));
            StandardizedFixture.Customizations.Add(
                new TypeRelay(
                    typeof(CharacterMovement),
                    typeof(CharacterMovementImpl)));

            StandardizedFixture.Customize <MovementImpl>(t => t
                                                         .With(x => x.HasGravity, true)
                                                         .With(x => x.IsPaused, false)
                                                         .With(x => x.Speed, 2)
                                                         );
            StandardizedFixture.Customize <CharacterMovementImpl>(t => t
                                                                  .Without(x => x.Targets));
        }
Esempio n. 9
0
        public CharacterCrowdMember GetCharacterUnderTestWithMockDependenciesAnddOrphanedWithRepo(CrowdRepository repo)
        {
            var characterUnderTest = StandardizedFixture.Create <CharacterCrowdMember>();

            return(characterUnderTest);
        }