CodeAnalyzersUnitTests.cs 1.12 KB
Newer Older
Nathan Bean's avatar
Nathan Bean committed
1
2
3
4
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading.Tasks;
using CodeAnalyzers.Test;

5
/*
Nathan Bean's avatar
Nathan Bean committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
namespace KSU.CS.Pendant.CodeAnalyzers.Test
{
    [TestClass]
    public class CodeAnalyzersUnitTest
    {
        //No diagnostics expected to show up
        [TestMethod]
        public async Task TestMethod1()
        {
            var test = @"";

            await CSharpAnalyzerVerifier<CommentsAnalyzer>.VerifyAnalyzerAsync(test);
        }

        //Diagnostic and CodeFix both triggered and checked for
        [TestMethod]
        public async Task TestMethod2()
        {
            var test = @"
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Diagnostics;

    namespace ConsoleApplication1
    {
        class {|#0:TypeName|}
        {   
        }
    }";

            var expected = CSharpAnalyzerVerifier<CommentsAnalyzer>.Diagnostic("CodeAnalyzers").WithLocation(0).WithArguments("TypeName");
            await CSharpAnalyzerVerifier<CommentsAnalyzer>.VerifyAnalyzerAsync(test, expected);
        }
    }
}
44
*/