Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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)));
 }
Beispiel #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));
 }
Beispiel #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));
 }
Beispiel #8
0
 public void Methods(string name, string expected)
 {
     Assert.That(string.Join(",", CecilTypeTest.GetType(name).Methods.Select(m => m.Name)),
                 Is.EqualTo(expected));
 }
Beispiel #9
0
 public void Parent(string name, string expected)
 {
     Assert.That(CecilTypeTest.GetType(name).Parent.Name, Is.EqualTo(expected));
 }
Beispiel #10
0
 public void Parameters(string name, string expected)
 {
     Assert.That(string.Join(",", CecilTypeTest.GetType(name).Parameters.Select(p => p.Name)),
                 Is.EqualTo(expected));
 }
Beispiel #11
0
 public void NestedTypes(string name, string expected)
 {
     Assert.That(string.Join(",", CecilTypeTest.GetType(name).NestedTypes.Select(n => n.Name)),
                 Is.EqualTo(expected));
 }
Beispiel #12
0
 public void Namespace(string name)
 {
     Assert.That(CecilTypeTest.GetType(name).Namespace, Is.EqualTo(typeof(CecilTypeTest).Namespace));
 }
Beispiel #13
0
 public void Name(string name)
 {
     Assert.That(CecilTypeTest.GetType(name).Name, Is.EqualTo($"{nameof(CecilTypeTest)}+{name}"));
 }
Beispiel #14
0
 public void Fields(string name, string expected)
 {
     Assert.That(string.Join(",", CecilTypeTest.GetType(name).Fields.Select(f => f.Name)),
                 Is.EqualTo(expected));
 }
Beispiel #15
0
 public void Visibility(string name, Visibility expected)
 {
     Assert.That(CecilTypeTest.GetType(name).Visibility, Is.EqualTo(expected));
 }
Beispiel #16
0
 public void Implementation(string name, Definition expected)
 {
     Assert.That(CecilTypeTest.GetType(name).Definition, Is.EqualTo(expected));
 }
Beispiel #17
0
 public void Interfaces(string name, string expected)
 {
     Assert.That(string.Join(",", CecilTypeTest.GetType(name).Interfaces.Select(i => i.Name)),
                 Is.EqualTo(expected));
 }