예제 #1
0
 public void NamespaceUsageTest()
 {
     var type = GetType();
     var namespaceDefinition = new NamespaceDefinition();
     namespaceDefinition.Name = "MyName";
     Assert.AreEqual("MyName", namespaceDefinition.Name);
     namespaceDefinition.AddType(type);
     Assert.AreEqual(1, namespaceDefinition.Types.Count);
     Assert.AreEqual(1, namespaceDefinition.GetTypes().Count());
     Assert.IsNotNull(namespaceDefinition.GetTypes().First());
     Assert.IsNotNull(namespaceDefinition.Types.First());
     var textSerialization = namespaceDefinition.ToString();
     Assert.IsNotNull(textSerialization);
     Assert.IsTrue(textSerialization.Contains(type.FullName));
 }
예제 #2
0
 public void ApiTest()
 {
     var myNamespace = new NamespaceDefinition();
     myNamespace.AddType(typeof (MyClass));
     var api = new AssemblyApi(new List<NamespaceDefinition> {myNamespace});
     var namespaces = api.GetNamespaces().ToList();
     Assert.AreEqual(1, namespaces.Count);
     foreach (var nspace in namespaces)
     {
         var classes = nspace.Types.ToList();
         Assert.AreEqual(1, classes.Count);
         foreach (var c in classes)
         {
             var members = c.GetPublicMembersSignatures().ToList();
             Assert.AreEqual(5, members.Count);
         }
     }
 }