Пример #1
0
        public virtual void FixtureSetUp()
        {
            //create a stub for this only since we don't want the slowdown of all of the universal analytics event tracking
            eventTrackerStub = MockRepository.GenerateStub <IEventTracker>();
            eventTrackerStub.Expect(stub => stub.TrackEvent(Arg <IUniversalAnalyticsEvent> .Is.Anything))
            .Repeat.Any();

            playedGameTracker = new UniversalAnalyticsNemeStatsEventTracker(eventTrackerStub, eventFactory);

            using (NemeStatsDbContext nemeStatsDbContext = new NemeStatsDbContext())
            {
                CleanUpTestData();

                testUserWithDefaultGamingGroup = SaveApplicationUser(
                    nemeStatsDbContext,
                    testApplicationUserNameForUserWithDefaultGamingGroup,
                    "*****@*****.**");
                testUserWithDefaultGamingGroupAndNoInvites = SaveApplicationUser(
                    nemeStatsDbContext,
                    testApplicationUserNameForUserWithDefaultGamingGroupAndNoInvites,
                    "*****@*****.**");
                testUserWithOtherGamingGroup = SaveApplicationUser(
                    nemeStatsDbContext,
                    testApplicationUserNameForUserWithOtherGamingGroup,
                    "*****@*****.**");
                testUserWithThirdGamingGroup = SaveApplicationUser(
                    nemeStatsDbContext,
                    testApplicationUserNameForUserWithThirdGamingGroup,
                    "*****@*****.**");

                using (NemeStatsDataContext dataContext = new NemeStatsDataContext())
                {
                    testGamingGroup = SaveGamingGroup(dataContext, testGamingGroup1Name, testUserWithDefaultGamingGroup);
                    testUserWithDefaultGamingGroup = UpdateDatefaultGamingGroupOnUser(testUserWithDefaultGamingGroup, testGamingGroup, dataContext);
                    testOtherGamingGroup           = SaveGamingGroup(dataContext, testGamingGroup2Name, testUserWithOtherGamingGroup);
                    testUserWithOtherGamingGroup   = UpdateDatefaultGamingGroupOnUser(testUserWithOtherGamingGroup, testOtherGamingGroup, dataContext);
                    testThirdGamingGroup           = SaveGamingGroup(dataContext, testGamingGroup3Name, testUserWithThirdGamingGroup);
                    testUserWithThirdGamingGroup   = UpdateDatefaultGamingGroupOnUser(testUserWithThirdGamingGroup,
                                                                                      testThirdGamingGroup, dataContext);

                    testGameDefinition  = SaveGameDefinition(nemeStatsDbContext, testGamingGroup.Id, testGameName);
                    testGameDefinition2 = SaveGameDefinition(nemeStatsDbContext, testGamingGroup.Id, testGameName2);
                    testGameDefinitionWithOtherGamingGroupId = SaveGameDefinition(nemeStatsDbContext, testOtherGamingGroup.Id, testGameNameForGameWithOtherGamingGroupId);
                    gameDefinitionWithNoChampion             = SaveGameDefinition(nemeStatsDbContext, testThirdGamingGroup.Id,
                                                                                  gameDefinitionWithNoChampionName);
                    anotherTestGameDefinitionWithOtherGamingGroupId = SaveGameDefinition(nemeStatsDbContext,
                                                                                         testOtherGamingGroup.Id, testGameNameForAnotherGameWithOtherGamingGroupId);
                    SavePlayers(nemeStatsDbContext, testGamingGroup.Id, testOtherGamingGroup.Id);

                    SaveGamingGroupInvitations(nemeStatsDbContext, dataContext);
                }

                using (NemeStatsDataContext dataContext = new NemeStatsDataContext())
                {
                    CreatePlayedGames(dataContext);
                }
            }
        }
Пример #2
0
        public virtual void FixtureSetUp()
        {
            //create a stub for this only since we don't want the slowdown of all of the universal analytics event tracking
            eventTrackerStub = MockRepository.GenerateStub<IEventTracker>();
            eventTrackerStub.Expect(stub => stub.TrackEvent(Arg<IUniversalAnalyticsEvent>.Is.Anything))
                .Repeat.Any();
             
            playedGameTracker = new UniversalAnalyticsNemeStatsEventTracker(eventTrackerStub, eventFactory);

            using (NemeStatsDbContext nemeStatsDbContext = new NemeStatsDbContext())
            {
                CleanUpTestData();

                testUserWithDefaultGamingGroup = SaveApplicationUser(
                    nemeStatsDbContext,
                    testApplicationUserNameForUserWithDefaultGamingGroup,
                    "*****@*****.**");
                testUserWithDefaultGamingGroupAndNoInvites = SaveApplicationUser(
                    nemeStatsDbContext,
                    testApplicationUserNameForUserWithDefaultGamingGroupAndNoInvites,
                    "*****@*****.**");
                testUserWithOtherGamingGroup = SaveApplicationUser(
                    nemeStatsDbContext,
                    testApplicationUserNameForUserWithOtherGamingGroup,
                    "*****@*****.**");
                testUserWithThirdGamingGroup = SaveApplicationUser(
                    nemeStatsDbContext,
                    testApplicationUserNameForUserWithThirdGamingGroup, 
                    "*****@*****.**");

                using (NemeStatsDataContext dataContext = new NemeStatsDataContext())
                {
                    testGamingGroup = SaveGamingGroup(dataContext, testGamingGroup1Name, testUserWithDefaultGamingGroup);
                    testUserWithDefaultGamingGroup = UpdateDatefaultGamingGroupOnUser(testUserWithDefaultGamingGroup, testGamingGroup, dataContext);
                    testOtherGamingGroup = SaveGamingGroup(dataContext, testGamingGroup2Name, testUserWithOtherGamingGroup);
                    testUserWithOtherGamingGroup = UpdateDatefaultGamingGroupOnUser(testUserWithOtherGamingGroup, testOtherGamingGroup, dataContext);
                    testThirdGamingGroup = SaveGamingGroup(dataContext, testGamingGroup3Name, testUserWithThirdGamingGroup);
                    testUserWithThirdGamingGroup = UpdateDatefaultGamingGroupOnUser(testUserWithThirdGamingGroup,
                        testThirdGamingGroup, dataContext);

                    testBoardGameGeekGameDefinition = SaveBoardGameGeekGameDefinition(dataContext);

                    testGameDefinition = SaveGameDefinition(nemeStatsDbContext, testGamingGroup.Id, testGameName, testBoardGameGeekGameDefinition.Id);
                    testGameDefinition2 = SaveGameDefinition(nemeStatsDbContext, testGamingGroup.Id, testGameName2);
                    testGameDefinitionWithOtherGamingGroupId = SaveGameDefinition(nemeStatsDbContext, testOtherGamingGroup.Id, testGameNameForGameWithOtherGamingGroupId);
                    gameDefinitionWithNoChampion = SaveGameDefinition(nemeStatsDbContext, testThirdGamingGroup.Id,
                        gameDefinitionWithNoChampionName);
                    anotherTestGameDefinitionWithOtherGamingGroupId = SaveGameDefinition(nemeStatsDbContext,
                        testOtherGamingGroup.Id, testGameNameForAnotherGameWithOtherGamingGroupId);
                    SavePlayers(nemeStatsDbContext, testGamingGroup.Id, testOtherGamingGroup.Id);
                }

                using(NemeStatsDataContext dataContext = new NemeStatsDataContext())
                {
                    CreatePlayedGames(dataContext);
                }
            }
        }