Beispiel #1
0
        private static void CheckIntegers(List <IntegerData> integers, TypeSet t, Action CheckContents, ref ParameterType modifiedType)
        {
            IntegerData Integer1 = new IntegerData("int1", ParameterType.Parse("e051bfd8-d9d8-4f14-bd39-0ec1a9e9073b"), 456, 123);
            IntegerData Integer2 = new IntegerData("repeat", ParameterType.Parse("4427eb13-e799-4959-86a8-31a2dbd71b03"), 456, 123);
            IntegerData Integer3 = new IntegerData("repeat", ParameterType.Parse("e8aa3cef-8b60-4b08-bb8d-e0a9b2a2085e"), 1, 0);

            var a = Integer1;

            t.AddInteger(a);
            integers.Add(a);
            Assert.That(modifiedType, Is.EqualTo(a.TypeId));
            modifiedType = null;
            CheckContents();

            a = Integer2;
            t.AddInteger(a);
            integers.Add(a);
            Assert.That(modifiedType, Is.EqualTo(a.TypeId));
            modifiedType = null;
            CheckContents();

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

            a = Integer3;
            t.AddInteger(a);
            integers.Add(a);
            Assert.That(modifiedType, Is.EqualTo(a.TypeId));
            modifiedType = null;
            CheckContents();

            IntegerData Integer2Replacement = new IntegerData("Integer2 replacement", ParameterType.Parse("4427eb13-e799-4959-86a8-31a2dbd71b03"), 234, -234);

            t.ModifyInteger(Integer2Replacement);
            integers[integers.IndexOf(Integer2)] = Integer2Replacement;
            Assert.That(modifiedType, Is.EqualTo(Integer2Replacement.TypeId));
            modifiedType = null;
            CheckContents();

            IntegerData Integer3Replacement = new IntegerData("replacement integer 3", ParameterType.Parse("e8aa3cef-8b60-4b08-bb8d-e0a9b2a2085e"), 1, 0);

            t.RenameType(Integer3.TypeId, Integer3Replacement.Name);
            integers[integers.IndexOf(Integer3)] = Integer3Replacement;
            Assert.That(modifiedType, Is.EqualTo(Integer3Replacement.TypeId));
            modifiedType = null;
            CheckContents();
        }