Пример #1
0
        public void CodeElements_OneClassWithNoNamespaceInProject_ReturnsOneCodeClassItem()
        {
            CreateCodeModel();
            AddClassToProjectContent(String.Empty, "TestClass");

            CodeElements codeElements = codeModel.CodeElements;
            CodeClass2   codeClass    = codeElements.FirstCodeClass2OrDefault();

            Assert.AreEqual(1, codeElements.Count);
            Assert.AreEqual("TestClass", codeClass.FullName);
        }
Пример #2
0
        public void PartialClasses_ClassIsNotPartial_ReturnsClass()
        {
            CreateProjectContent();
            CreatePublicClass("MyNamespace.MyClass");
            CreateClass();

            CodeElements partialClasses = codeClass.PartialClasses;
            CodeClass    firstClass     = partialClasses.FirstCodeClass2OrDefault();

            Assert.AreEqual(1, partialClasses.Count);
            Assert.AreEqual(codeClass, firstClass);
        }
Пример #3
0
        public void Members_NamespaceHasOneClass_ReturnsOneClass()
        {
            CreateProjectContent();
            AddClassToProjectContent("Tests", "Tests.MyClass");
            CreateCodeNamespace("Tests");

            CodeElements members   = codeNamespace.Members;
            CodeClass2   codeClass = members.FirstCodeClass2OrDefault();

            Assert.AreEqual(1, members.Count);
            Assert.AreEqual("Tests.MyClass", codeClass.FullName);
        }
Пример #4
0
        public void BaseTypes_ClassBaseTypeIsSystemObject_ReturnsSystemObject()
        {
            CreateProjectContent();
            CreatePublicClass("MyClass");
            AddBaseTypeToClass("System.Object");

            CodeElements codeElements = codeClass.Bases;
            CodeClass2   baseClass    = codeElements.FirstCodeClass2OrDefault();

            Assert.AreEqual(1, codeElements.Count);
            Assert.AreEqual("System.Object", baseClass.FullName);
            Assert.AreEqual("Object", baseClass.Name);
        }