예제 #1
0
        private static void CheckEnums(List <EnumerationData> enums, TypeSet t, Action CheckContents, ref ParameterType modifiedType, bool hidden)
        {
            EnumerationData Enumeration1 = new EnumerationData("enum1", ParameterType.Parse(hidden ? "e25f2768-ac00-4320-a558-12b51d85d771" : "f70fb4d1-59f5-4618-9bc4-8da19f943da2"), new[] { new EnumerationData.Element("value1", Guid.Parse("9ee98b1e-fb29-42c5-8a26-903a8aecacc0")),
                                                                                                                                                                                               new EnumerationData.Element("value2", Guid.Parse("a3ed3b47-9985-4f17-b791-4155cc7196f4")) });
            EnumerationData Enumeration2 = new EnumerationData("enum2", ParameterType.Parse(hidden ? "19bf99ff-98f2-4ab3-96d6-1f7e61d98ae7" : "a532c7c0-2806-4def-9fb2-5182b6803cbe"), new[] { new EnumerationData.Element("value1", Guid.Parse("e80fd4c3-eb10-4309-b683-79c3675b6fb8")),
                                                                                                                                                                                               new EnumerationData.Element("value2", Guid.Parse("c0b0a09e-4825-479e-87dc-599bdacf045f")) });
            EnumerationData Enumeration3 = new EnumerationData("enum3", ParameterType.Parse(hidden ? "b78e53cd-717b-446f-9ab2-fbbf5c41b067" : "aa274a73-95c1-4272-bb23-9c9cabeb183e"), new[] { new EnumerationData.Element("asd", Guid.Parse("27b59086-7e9b-4b7f-8796-a7a23eb727c1")),
                                                                                                                                                                                               new EnumerationData.Element("sdasd", Guid.Parse("b08cf9e0-9d77-42cf-9f1c-a21def2b79d3")),
                                                                                                                                                                                               new EnumerationData.Element("sdasd2", Guid.Parse("4f73eaad-86fe-4cbb-adbc-016724399ae5")) });

            var a = Enumeration1;

            t.AddEnum(a, hidden);
            enums.Add(a);
            Assert.That(modifiedType, Is.EqualTo(a.TypeId));
            modifiedType = null;
            CheckContents();

            a = Enumeration2;
            t.AddEnum(a, hidden);
            enums.Add(a);
            Assert.That(modifiedType, Is.EqualTo(a.TypeId));
            modifiedType = null;
            CheckContents();

            a = Enumeration1;
            t.Remove(a.TypeId);
            enums.Remove(a);
            Assert.That(modifiedType, Is.EqualTo(a.TypeId));
            modifiedType = null;
            CheckContents();

            a = Enumeration3;
            t.AddEnum(a, hidden);
            enums.Add(a);
            Assert.That(modifiedType, Is.EqualTo(a.TypeId));
            modifiedType = null;
            CheckContents();

            EnumerationData Enum2Replacement = new EnumerationData("repeat", Enumeration2.TypeId, new[] { new EnumerationData.Element("asd", Guid.Parse("24be3852-b34f-4f20-ab72-3e391e939872")) });

            t.ModifyEnum(Enum2Replacement);
            enums[enums.IndexOf(Enumeration2)] = Enum2Replacement;
            Assert.That(modifiedType, Is.EqualTo(Enum2Replacement.TypeId));
            modifiedType = null;
            CheckContents();

            EnumerationData Enumeration3Replacement = new EnumerationData("enum3 replacement", Enumeration3.TypeId, new[] { new EnumerationData.Element("asd", Guid.Parse("27b59086-7e9b-4b7f-8796-a7a23eb727c1")),
                                                                                                                            new EnumerationData.Element("sdasd", Guid.Parse("b08cf9e0-9d77-42cf-9f1c-a21def2b79d3")),
                                                                                                                            new EnumerationData.Element("sdasd2", Guid.Parse("4f73eaad-86fe-4cbb-adbc-016724399ae5")) });

            t.RenameType(Enumeration3.TypeId, Enumeration3Replacement.Name);
            enums[enums.IndexOf(Enumeration3)] = Enumeration3Replacement;
            Assert.That(modifiedType, Is.EqualTo(Enumeration3Replacement.TypeId));
            modifiedType = null;
            CheckContents();
        }