public void MergeOneSoundAchievementsResultInDynamicSoundsAchievement()
        {
            var oneSoundAchievement1 = VoicepackSampleCreator.CreateOneSoundAchievement("pakSoundPath1", "fileSoundPath1");
            var oneSoundAchievement2 = VoicepackSampleCreator.CreateOneSoundAchievement("pakSoundPath2", "fileSoundPath2");


            VoicepackMerger.MergeAchievement(oneSoundAchievement1, oneSoundAchievement2);


            var expectedAchievementSameOrder = VoicepackSampleCreator.CreateDynamicSoundsAchievement(new string[2, 2]
            {
                { "pakSoundPath1", "fileSoundPath1" },
                { "pakSoundPath2", "fileSoundPath2" }
            });

            Assert.IsTrue(VoicepackComparer.AchievementOptionsDynamicSoundsEqual(
                              expectedAchievementSameOrder, oneSoundAchievement1));

            //also check other order
            var expectedAchievementDifferentOrder = VoicepackSampleCreator.CreateDynamicSoundsAchievement(new string[2, 2]
            {
                { "pakSoundPath2", "fileSoundPath2" },
                { "pakSoundPath1", "fileSoundPath1" }
            });

            Assert.IsTrue(VoicepackComparer.AchievementOptionsDynamicSoundsEqual(
                              expectedAchievementDifferentOrder, oneSoundAchievement1));
        }
Beispiel #2
0
        public void TwoIdenticalSampleVoicepacksHaveEqualSoundFileNames()
        {
            var samplePack1 = VoicepackSampleCreator.Create();
            var samplePack2 = VoicepackSampleCreator.Create();

            Assert.IsTrue(samplePack2.EqualSoundFilenames(samplePack1));
        }
        public void MergeDynamicSoundsAchievments()
        {
            var dynamicSoundsAchievment1 = VoicepackSampleCreator.CreateDynamicSoundsAchievement(new string[2, 2]
            {
                { "pakSoundPath3", "fileSoundPath3" },
                { "pakSoundPath2", "fileSoundPath2" }
            });

            var dynamicSoundsAchievment2 = VoicepackSampleCreator.CreateDynamicSoundsAchievement(new string[2, 2]
            {
                { "pakSoundPath1", "fileSoundPath1" },
                { "pakSoundPath4", "fileSoundPath4" }
            });

            VoicepackMerger.MergeAchievement(dynamicSoundsAchievment1, dynamicSoundsAchievment2);

            var expectedAchievement = VoicepackSampleCreator.CreateDynamicSoundsAchievement(new string[4, 2]
            {
                { "pakSoundPath2", "fileSoundPath2" },
                { "pakSoundPath1", "fileSoundPath1" },
                { "pakSoundPath3", "fileSoundPath3" },
                { "pakSoundPath4", "fileSoundPath4" }
            });

            Assert.IsTrue(VoicepackComparer.AchievementOptionsDynamicSoundsEqual(expectedAchievement, dynamicSoundsAchievment1));
        }
        public void MergeAchievementsInAchievementList()
        {
            var dynamicSoundsAchievment1 = VoicepackSampleCreator.CreateDynamicSoundsAchievement(new string[2, 2]
            {
                { "pakSoundPath3", "fileSoundPath3" },
                { "pakSoundPath2", "fileSoundPath2" }
            });

            var dynamicSoundsAchievment2 = VoicepackSampleCreator.CreateDynamicSoundsAchievement(new string[2, 2]
            {
                { "pakSoundPath1", "fileSoundPath1" },
                { "pakSoundPath4", "fileSoundPath4" }
            });

            var dynamicSoundsAchievment3 = VoicepackSampleCreator.CreateDynamicSoundsAchievement(new string[2, 2]
            {
                { "pakSoundPath5", "fileSoundPath5" },
                { "pakSoundPath6", "fileSoundPath6" }
            });

            var achievementList1 = new XmlDictionary <string, AchievementOptions>
            {
                ["key1"] = dynamicSoundsAchievment1,
                ["key2"] = dynamicSoundsAchievment2
            };

            var achievementList2 = new XmlDictionary <string, AchievementOptions>
            {
                ["key1"] = dynamicSoundsAchievment2,
                ["key2"] = dynamicSoundsAchievment3
            };

            VoicepackMerger.MergeAchievementList(achievementList1, achievementList2);

            var key1ExpectedAchievement = VoicepackSampleCreator.CreateDynamicSoundsAchievement(new string[4, 2]
            {
                { "pakSoundPath1", "fileSoundPath1" },
                { "pakSoundPath4", "fileSoundPath4" },
                { "pakSoundPath3", "fileSoundPath3" },
                { "pakSoundPath2", "fileSoundPath2" }
            });

            var key2ExpectedAchievement = VoicepackSampleCreator.CreateDynamicSoundsAchievement(new string[4, 2]
            {
                { "pakSoundPath1", "fileSoundPath1" },
                { "pakSoundPath4", "fileSoundPath4" },
                { "pakSoundPath5", "fileSoundPath5" },
                { "pakSoundPath6", "fileSoundPath6" }
            });

            var expectedList = new XmlDictionary <string, AchievementOptions>();

            expectedList["key1"] = key1ExpectedAchievement;
            expectedList["key2"] = key2ExpectedAchievement;

            Assert.IsTrue(VoicepackComparer.EqualAchievementLists(expectedList, achievementList1));
        }
Beispiel #5
0
        public void IdenticalSampleVoicepacksHaveEqualComponentInformation()
        {
            _testPack1.InitializeToDefault();
            _testPack1.Voicepack.componentInformation = VoicepackSampleCreator.CreateSampleCompInfo();
            _testPack2.InitializeToDefault();
            _testPack2.Voicepack.componentInformation = VoicepackSampleCreator.CreateSampleCompInfo();

            Assert.IsTrue(_testPack1.EqualComponentInfo(_testPack2));
        }
Beispiel #6
0
        public void SlightlyDifferentSampleVoicepacksDontHaveEqualComponentInformation()
        {
            _testPack1.InitializeToDefault();
            _testPack1.Voicepack.componentInformation = VoicepackSampleCreator.CreateSampleCompInfo();
            _testPack2.InitializeToDefault();
            _testPack2.Voicepack.componentInformation        = VoicepackSampleCreator.CreateSampleCompInfo();
            _testPack2.Voicepack.componentInformation.author = "Someone Else";

            Assert.IsFalse(_testPack1.EqualComponentInfo(_testPack2));
        }
Beispiel #7
0
        public void SlightlyDifferentSampleVoicepacksDontHaveEqualSoundFileNames()
        {
            var samplePack1 = VoicepackSampleCreator.Create();
            var samplePack2 = VoicepackSampleCreator.Create();

            samplePack2.Voicepack.groupManager.achievementList[VoicepackSampleCreator.SampleAchievements[1]]
            .dynamicSounds.sounds[0].pakSoundFile = "different sound filename";

            Assert.IsFalse(samplePack2.EqualSoundFilenames(samplePack1));
        }
        public void DontRemoveComponentDataItemWithReferenceToNewStyleDynamicSoundAchievment()
        {
            var dynamicSound = "dynamicSound";

            pack.Voicepack.groupManager.achievementList["achievementName2"] =
                VoicepackSampleCreator.CreateDynamicSoundsAchievement(new string[2, 2] {
                { "", "" }, { dynamicSound, "" }
            });
            pack.Voicepack.componentData.Add(dynamicSound, new ComponentData());

            VoicepackCleaner.RemoveUnusedComponentData(pack);

            Assert.IsTrue(pack.Voicepack.componentData.ContainsKey(dynamicSound));
        }
        public void MergeOneSoundAchievementWithDefault()
        {
            var defaultAchievement = new AchievementOptions();

            defaultAchievement.Initialize();

            var oneSoundAchievement = VoicepackSampleCreator.CreateOneSoundAchievement("pakSoundPath", "fileSoundPath");


            VoicepackMerger.MergeAchievement(defaultAchievement, oneSoundAchievement);


            var expectedAchievement = oneSoundAchievement;

            Assert.IsTrue(VoicepackComparer.AchievementOptionsOneSoundEqual(expectedAchievement, defaultAchievement));
        }
        public void FindAndReplaceNewStyleDynamicSounsPath()
        {
            var findMe0      = findMe + "0";
            var findMe1      = findMe + "1";
            var replaceWith1 = replaceWith + "1";
            var replaceWith0 = replaceWith + "0";

            pack.Voicepack.groupManager.achievementList[key] =
                VoicepackSampleCreator.CreateDynamicSoundsAchievement(new string[2, 2] {
                { findMe0, "" }, { findMe1, "" }
            });

            Assert.IsTrue(VoicepackCleaner.FindPAKreferenceInVoicepackAndReplace(pack, findMe1, replaceWith1));
            Assert.IsFalse(VoicepackCleaner.FindPAKreferenceInVoicepackAndReplace(pack, findMe1));
            Assert.IsTrue(VoicepackCleaner.FindPAKreferenceInVoicepackAndReplace(pack, replaceWith1));

            Assert.IsTrue(VoicepackCleaner.FindPAKreferenceInVoicepackAndReplace(pack, findMe0, replaceWith0));
            Assert.IsFalse(VoicepackCleaner.FindPAKreferenceInVoicepackAndReplace(pack, findMe0));
            Assert.IsTrue(VoicepackCleaner.FindPAKreferenceInVoicepackAndReplace(pack, replaceWith0));
        }
        public void MergeOneSoundAchievementWithDynamicSoundsAchievement()
        {
            var oneSoundAchievement = VoicepackSampleCreator.CreateOneSoundAchievement("pakSoundPath1", "fileSoundPath1");

            var dynamicSoundsAchievment = VoicepackSampleCreator.CreateDynamicSoundsAchievement(new string[2, 2]
            {
                { "pakSoundPath3", "fileSoundPath3" },
                { "pakSoundPath2", "fileSoundPath2" }
            });

            VoicepackMerger.MergeAchievement(oneSoundAchievement, dynamicSoundsAchievment);

            var expectedAchievement = VoicepackSampleCreator.CreateDynamicSoundsAchievement(new string[3, 2]
            {
                { "pakSoundPath3", "fileSoundPath3" },
                { "pakSoundPath2", "fileSoundPath2" },
                { "pakSoundPath1", "fileSoundPath1" }
            });

            Assert.IsTrue(VoicepackComparer.AchievementOptionsDynamicSoundsEqual(expectedAchievement, oneSoundAchievement));
        }