Esempio n. 1
0
        public void Arguments(string fieldName, string expected)
        {
            var fieldType = CecilTypeTest.GetType("CecilMemberTypeParameters").Fields.First(field => field.Name == fieldName).Type;

            Assert.That(string.Join(",", fieldType.Arguments.Select(p => p.Name)),
                        Is.EqualTo(expected));
        }
Esempio n. 2
0
        public void Model(int index, Model expected)
        {
            var type     = CecilTypeTest.GetType(nameof(CecilTypeModel));
            var method   = type.Methods.Single(m => m.Definition == Definition.Abstract);
            var argument = method.Arguments.ToArray()[index];

            Assert.That(argument.Type.Model, Is.EqualTo(expected));
        }
Esempio n. 3
0
        public void Equals(string name1, string name2, bool expected)
        {
            var type1 = CecilTypeTest.GetType(name1);
            var type2 = CecilTypeTest.GetType(name2);

            Assert.That(type1.Equals(type2), Is.EqualTo(expected));
            Assert.That(type1 == type2, Is.EqualTo(expected));
            Assert.That(type1 != type2, Is.EqualTo(!expected));
        }
Esempio n. 4
0
        public void ElementOrNull(int index, bool defined, string expected)
        {
            var type     = CecilTypeTest.GetType(nameof(CecilTypeElementOrNull));
            var method   = type.Methods.Single(m => m.Definition == Definition.Abstract);
            var argument = method.Arguments.ToArray()[index];

            Assert.That(argument.Type.ElementOrNull, defined ? Is.Not.Null : Is.Null);
            Assert.That(argument.Type.ElementOrNull?.Name ?? string.Empty, Is.EqualTo(expected));
        }
Esempio n. 5
0
 public void BaseOrNullIsNull(string name)
 {
     Assert.That(CecilTypeTest.GetType(name).BaseOrNull, Is.Not.Null);
     Assert.That(CecilTypeTest.GetType(name).BaseOrNull.Name, Is.EqualTo(nameof(System.Object)));
 }
Esempio n. 6
0
 public void BaseOrNullIsDefined(string name, string expected)
 {
     Assert.That(CecilTypeTest.GetType(name).BaseOrNull, Is.Not.Null);
     Assert.That(CecilTypeTest.GetType(name).BaseOrNull.Name, Is.EqualTo(expected));
 }
Esempio n. 7
0
 public void Attributes(string name, string expected)
 {
     Assert.That(string.Join(",", CecilTypeTest.GetType(name).Attributes.Select(a => a.Type.Name)),
                 Is.EqualTo(expected));
 }
Esempio n. 8
0
 public void Methods(string name, string expected)
 {
     Assert.That(string.Join(",", CecilTypeTest.GetType(name).Methods.Select(m => m.Name)),
                 Is.EqualTo(expected));
 }
Esempio n. 9
0
 public void Parent(string name, string expected)
 {
     Assert.That(CecilTypeTest.GetType(name).Parent.Name, Is.EqualTo(expected));
 }
Esempio n. 10
0
 public void Parameters(string name, string expected)
 {
     Assert.That(string.Join(",", CecilTypeTest.GetType(name).Parameters.Select(p => p.Name)),
                 Is.EqualTo(expected));
 }
Esempio n. 11
0
 public void NestedTypes(string name, string expected)
 {
     Assert.That(string.Join(",", CecilTypeTest.GetType(name).NestedTypes.Select(n => n.Name)),
                 Is.EqualTo(expected));
 }
Esempio n. 12
0
 public void Namespace(string name)
 {
     Assert.That(CecilTypeTest.GetType(name).Namespace, Is.EqualTo(typeof(CecilTypeTest).Namespace));
 }
Esempio n. 13
0
 public void Name(string name)
 {
     Assert.That(CecilTypeTest.GetType(name).Name, Is.EqualTo($"{nameof(CecilTypeTest)}+{name}"));
 }
Esempio n. 14
0
 public void Fields(string name, string expected)
 {
     Assert.That(string.Join(",", CecilTypeTest.GetType(name).Fields.Select(f => f.Name)),
                 Is.EqualTo(expected));
 }
Esempio n. 15
0
 public void Visibility(string name, Visibility expected)
 {
     Assert.That(CecilTypeTest.GetType(name).Visibility, Is.EqualTo(expected));
 }
Esempio n. 16
0
 public void Implementation(string name, Definition expected)
 {
     Assert.That(CecilTypeTest.GetType(name).Definition, Is.EqualTo(expected));
 }
Esempio n. 17
0
 public void Interfaces(string name, string expected)
 {
     Assert.That(string.Join(",", CecilTypeTest.GetType(name).Interfaces.Select(i => i.Name)),
                 Is.EqualTo(expected));
 }