2
// VariableDeclarationStatementTests.cs
5
// Mike Krüger <mkrueger@xamarin.com>
7
// Copyright (c) 2011 Xamarin Inc.
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:
16
// The above copyright notice and this permission notice shall be included in
17
// all copies or substantial portions of the Software.
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
27
using NUnit.Framework;
29
namespace ICSharpCode.NRefactory.CSharp.CodeCompletion
31
public class VariableDeclarationStatementTests : TestBase
34
public void TestDefaultBehavior ()
36
var provider = CodeCompletionBugTests.CreateProvider (
46
Assert.IsTrue (provider == null || provider.Count == 0, "provider should be empty.");
50
public void TestDefaultBehaviorInForeach ()
52
var provider = CodeCompletionBugTests.CreateProvider (
62
Assert.IsTrue (provider == null || provider.Count == 0, "provider should be empty.");
66
public void TestIntNameProposal ()
68
var provider = CodeCompletionBugTests.CreateCtrlSpaceProvider (
78
Assert.IsNotNull (provider.Find ("i"), "name proposal 'i' not found.");
79
Assert.IsNotNull (provider.Find ("j"), "name proposal 'j' not found.");
80
Assert.IsNotNull (provider.Find ("k"), "name proposal 'k' not found.");
84
public void TestNameProposal ()
86
var provider = CodeCompletionBugTests.CreateCtrlSpaceProvider (
96
Assert.IsNotNull (provider.Find ("myTest"), "name proposal 'myTest' not found.");
97
Assert.IsNotNull (provider.Find ("test"), "name proposal 'test' not found.");
101
public void TestNameProposalForeach ()
103
var provider = CodeCompletionBugTests.CreateCtrlSpaceProvider (
113
Assert.IsNotNull (provider.Find ("myTest"), "name proposal 'myTest' not found.");
114
Assert.IsNotNull (provider.Find ("test"), "name proposal 'test' not found.");
118
/// Bug 1799 - [New Resolver] Invalid code completion when typing name of variable
121
public void TestBug1799 ()
123
var provider = CodeCompletionBugTests.CreateProvider (
129
for (int n=0;n<10;n++) {
135
Assert.IsTrue (provider == null || provider.Count == 0, "provider should be empty.");