Esempio n. 1
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. 2
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. 3
0
        public CharacterCrowdMember GetCharacterUnderTestWithMockDependenciesAnddOrphanedWithRepo(CrowdRepository repo)
        {
            var characterUnderTest = StandardizedFixture.Create <CharacterCrowdMember>();

            return(characterUnderTest);
        }