public void ShouldBeOk() { SettingsHelper.UseXMLComments = true; var document = SyntaxMapper.MapDocumentVB(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\Files\\VisualBasic\\TestMethodsWithComments.vb")); Assert.IsTrue(document.Any()); // First item should be a namespace Assert.AreEqual(CodeItemKindEnum.Class, document.First().Kind); // Inner item should be a class var innerClass = document.First() as CodeClassItem; // Class should have a method var methodWithComment = innerClass.Members.First() as CodeFunctionItem; Assert.AreEqual("Super important summary", methodWithComment.Tooltip); // Class should have a method var methodWithoutComment = innerClass.Members[1] as CodeFunctionItem; Assert.AreEqual("Private Object FunctionWithoutComment ()", methodWithoutComment.Tooltip); // Class should have a method var methodWithMultipleComment = innerClass.Members[2] as CodeFunctionItem; Assert.AreEqual("Multiple comment - summary", methodWithMultipleComment.Tooltip); // Class should have a method var methodWithReorderedComment = innerClass.Members[3] as CodeFunctionItem; Assert.AreEqual("Multiple comment - summary", methodWithReorderedComment.Tooltip); }
public void ShouldBeOkVB() { var document = SyntaxMapper.MapDocumentVB(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\Files\\VisualBasic\\TestProperties.vb")); Assert.IsTrue(document.Any()); // First item should be a namespace Assert.AreEqual(CodeItemKindEnum.Class, document.First().Kind); // Inner item should be a class var innerClass = document.First() as CodeClassItem; // Class should have properties var propertyGetSet = innerClass.Members.First() as CodeFunctionItem; Assert.AreEqual(" {get,set}", propertyGetSet.Parameters); var propertyGet = innerClass.Members[1] as CodeFunctionItem; Assert.AreEqual(" {get}", propertyGet.Parameters); var propertySet = innerClass.Members[2] as CodeFunctionItem; Assert.AreEqual(" {set}", propertySet.Parameters); var property = innerClass.Members[3] as CodeFunctionItem; Assert.IsNull(property.Parameters); var propertyShorthand = innerClass.Members[4] as CodeFunctionItem; Assert.AreEqual("String", property.Type); }
public void Setup() { var document = SyntaxMapper.MapDocumentVB(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\Files\\VisualBasic\\TestMethods.vb")); Assert.IsTrue(document.Any()); // First item should be a class Assert.AreEqual(CodeItemKindEnum.Class, document.First().Kind); // Inner item should be a class _innerClass = document.First() as CodeClassItem; }
public void TestInterfaceShouldBeOkVB() { var document = SyntaxMapper.MapDocumentVB(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\Files\\VisualBasic\\TestInterfaces.vb")); Assert.IsTrue(document.Any()); // First item should be a namespace Assert.AreEqual(CodeItemKindEnum.Interface, document.First().Kind); // Namespace item should have 1 member Assert.AreEqual(1, (document.First() as IMembers).Members.Count); }
public void EnumsShouldBeOkVB() { var document = SyntaxMapper.MapDocumentVB(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\Files\\VisualBasic\\TestModules.vb")); Assert.IsTrue(document.Any()); var innerEnum = (document.First() as IMembers).Members.First() as CodeClassItem; // First inner item should be an enum Assert.AreEqual(CodeItemKindEnum.Enum, innerEnum.Kind); // Enum should have 5 members Assert.AreEqual(5, innerEnum.Members.Count()); }
public void ClassInheritanceShouldBeOkVB() { var document = SyntaxMapper.MapDocumentVB(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\Files\\VisualBasic\\TestClasses.vb")); Assert.IsTrue(document.Any()); // First item should be a base class Assert.AreEqual(CodeItemKindEnum.Class, document.First().Kind); var innerClass = document.First() as CodeClassItem; // Second item should be an inheriting class Assert.AreEqual(CodeItemKindEnum.Class, document.Last().Kind); var inheritingClass = document.Last() as CodeClassItem; Assert.AreEqual(" : Class1", inheritingClass.Parameters); }
public void TestRegionsVB() { var document = SyntaxMapper.MapDocumentVB(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\Files\\VisualBasic\\TestRegions.vb")); Assert.IsTrue(document.Any()); // There should be a single class var regionClass = document.First() as CodeClassItem; Assert.NotNull(regionClass); // The class should have a property in it Assert.NotNull(regionClass.Members.FirstOrDefault(m => m.Name.Equals("outsideRegion$"))); // The class should have a region in it var regionR1 = regionClass.Members.FirstOrDefault(m => m.Name.Equals("#FirstRegion")) as CodeRegionItem; Assert.NotNull(regionR1, "Region #FirstRegion not found"); // Region R1 should have a property in it Assert.NotNull(regionR1.Members.FirstOrDefault(m => m.Name.Equals("insideRegion$")), "No property inside region found"); }
public void ShouldBeOkVB() { var document = SyntaxMapper.MapDocumentVB(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\Files\\VisualBasic\\TestFields.vb")); Assert.IsTrue(document.Any()); // First item should be a class Assert.AreEqual(CodeItemKindEnum.Class, document.First().Kind); // Inner item should be a class var innerClass = document.First() as CodeClassItem; // Class should have properties var publicConst = innerClass.Members.First() as CodeItem; Assert.AreEqual(CodeItemAccessEnum.Public, publicConst.Access); Assert.AreEqual(CodeItemKindEnum.Constant, publicConst.Kind); var protectedVersion = innerClass.Members[1] as CodeItem; Assert.AreEqual(CodeItemAccessEnum.Protected, protectedVersion.Access); Assert.AreEqual(CodeItemKindEnum.Variable, protectedVersion.Kind); var publicField = innerClass.Members[2] as CodeItem; Assert.AreEqual(CodeItemAccessEnum.Public, publicField.Access); Assert.AreEqual(CodeItemKindEnum.Variable, publicField.Kind); var privateSecret = innerClass.Members[3] as CodeItem; Assert.AreEqual(CodeItemAccessEnum.Private, privateSecret.Access); Assert.AreEqual(CodeItemKindEnum.Variable, privateSecret.Kind); var local = innerClass.Members.Last() as CodeItem; Assert.AreEqual(CodeItemAccessEnum.Private, local.Access); Assert.AreEqual(CodeItemKindEnum.Variable, local.Kind); }