예제 #1
0
        public void DefType_AllDefTypeAreFound()
        {
            const string inputCode =
                @"DefBool A
DefByte B
DefInt C
DefLng D
DefCur E
DefSng F
DefDbl G
DefDate H
DefStr I
DefObj J
DefVar K
Public Function Zoo()
End Function";

            var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out _);

            using (var state = MockParser.CreateAndParse(vbe.Object))
            {
                var inspection        = new DefTypeStatementInspection(state);
                var inspector         = InspectionsHelper.GetInspector(inspection);
                var inspectionResults = inspector.FindIssuesAsync(state, CancellationToken.None).Result;

                Assert.AreEqual(11, inspectionResults.Count());
            }
        }
예제 #2
0
        public void InspectionName()
        {
            const string inspectionName = "DefTypeStatementInspection";
            var          inspection     = new DefTypeStatementInspection(null);

            Assert.AreEqual(inspectionName, inspection.Name);
        }
예제 #3
0
        public void DefType_SingleResultFound(string type)
        {
            const string inputCode =
                @"Def{0} A
Public Function aFoo()
End Function";

            var vbe = MockVbeBuilder.BuildFromSingleStandardModule(string.Format(inputCode, type), out _);

            using (var state = MockParser.CreateAndParse(vbe.Object))
            {
                var inspection        = new DefTypeStatementInspection(state);
                var inspector         = InspectionsHelper.GetInspector(inspection);
                var inspectionResults = inspector.FindIssuesAsync(state, CancellationToken.None).Result;

                Assert.AreEqual(1, inspectionResults.Count());
            }
        }