~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/nrefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantConstructorTests.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// 
 
2
// RedundantConstructorTest.cs
 
3
//  
 
4
// Author:
 
5
//       Ji Kun <jikun.nus@gmail.com>
 
6
// 
 
7
// Copyright (c) 2013 Ji Kun
 
8
// 
 
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
 
10
// of this software and associated documentation files (the "Software"), to deal
 
11
// in the Software without restriction, including without limitation the rights
 
12
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
13
// copies of the Software, and to permit persons to whom the Software is
 
14
// furnished to do so, subject to the following conditions:
 
15
// 
 
16
// The above copyright notice and this permission notice shall be included in
 
17
// all copies or substantial portions of the Software.
 
18
// 
 
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
20
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
21
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
22
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
23
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
25
// THE SOFTWARE.
 
26
using System;
 
27
using NUnit.Framework;
 
28
using ICSharpCode.NRefactory.CSharp.Refactoring;
 
29
using ICSharpCode.NRefactory.CSharp.CodeActions;
 
30
 
 
31
namespace ICSharpCode.NRefactory.CSharp.CodeIssues
 
32
{
 
33
        [TestFixture]
 
34
        public class RedundantConstructorTests : InspectionActionTestBase
 
35
        {
 
36
                [Test]
 
37
                public void TestInspectorCase1()
 
38
                {
 
39
                        var input = @"using System;class Test {private int member; public Test(){}}";
 
40
 
 
41
                        TestRefactoringContext context;
 
42
                        var issues = GetIssues(new RedundantConstructorIssue(), input, out context);
 
43
                        Assert.AreEqual(1, issues.Count);
 
44
 
 
45
                        CheckFix(context, issues, @"using System;class Test {private int member; }");
 
46
                }
 
47
 
 
48
                [Test]
 
49
                public void TestInspectorCase2()
 
50
                {
 
51
                        var input = @"using System;class Test {private int member;public Test(){} static Test(){}}";
 
52
                        
 
53
                        TestRefactoringContext context;
 
54
                        var issues = GetIssues(new RedundantConstructorIssue(), input, out context);
 
55
                        Assert.AreEqual(1, issues.Count);
 
56
                        
 
57
                        CheckFix(context, issues, @"using System;class Test {private int member; static Test(){}}");
 
58
                }
 
59
 
 
60
                [Test]
 
61
                public void TestResharperDisable()
 
62
                {
 
63
                        var input = @"using System;
 
64
        //Resharper disable RedundantConstructor
 
65
class Test {
 
66
        public Test(){
 
67
        }
 
68
        //Resharper restore RedundantConstructor        
 
69
        }";
 
70
                        
 
71
                        TestRefactoringContext context;
 
72
                        var issues = GetIssues(new RedundantConstructorIssue(), input, out context);
 
73
                        Assert.AreEqual(0, issues.Count);
 
74
                }
 
75
 
 
76
                [Test]
 
77
                public void TestNegateCase1()
 
78
                {
 
79
                        var input = @"using System;class Test {public Test(){;}}";
 
80
 
 
81
                        TestRefactoringContext context;
 
82
                        var issues = GetIssues(new RedundantConstructorIssue(), input, out context);
 
83
                        Assert.AreEqual(0, issues.Count);
 
84
                }
 
85
 
 
86
                [Test]
 
87
                public void TestNegateCase2()
 
88
                {
 
89
                        var input = @"using System;class Test {public Test(){;} private Test(){}}";
 
90
                        
 
91
                        TestRefactoringContext context;
 
92
                        var issues = GetIssues(new RedundantConstructorIssue(), input, out context);
 
93
                        Assert.AreEqual(0, issues.Count);
 
94
                }
 
95
        }
 
96
}
 
 
b'\\ No newline at end of file'