~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTanMethodFromMathImportAllTests.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.Collections;
 
6
using System.Collections.Generic;
 
7
using ICSharpCode.PythonBinding;
 
8
using ICSharpCode.SharpDevelop.Dom;
 
9
using ICSharpCode.SharpDevelop.Dom.CSharp;
 
10
using NUnit.Framework;
 
11
using PythonBinding.Tests.Utils;
 
12
 
 
13
namespace PythonBinding.Tests.Resolver
 
14
{
 
15
        [TestFixture]
 
16
        public class ResolveTanMethodFromMathImportAllTestFixture : ResolveTestsBase
 
17
        {
 
18
                protected override ExpressionResult GetExpressionResult()
 
19
                {
 
20
                        return new ExpressionResult("tan", ExpressionContext.Default);
 
21
                }
 
22
                
 
23
                protected override string GetPythonScript()
 
24
                {
 
25
                        return
 
26
                                "from sys import *\r\n" +
 
27
                                "from math import *\r\n" +
 
28
                                "from socket import *\r\n" +
 
29
                                "\r\n" +
 
30
                                "tan\r\n" +
 
31
                                "\r\n";
 
32
                }
 
33
                
 
34
                [Test]
 
35
                public void ResolveResultIsMethodGroupResolveResult()
 
36
                {
 
37
                        Assert.IsTrue(resolveResult is MethodGroupResolveResult);
 
38
                }
 
39
                
 
40
                [Test]
 
41
                public void ResolveResultMethodNameIsTan()
 
42
                {
 
43
                        Assert.AreEqual("tan", MethodResolveResult.Name);
 
44
                }
 
45
                
 
46
                MethodGroupResolveResult MethodResolveResult {
 
47
                        get { return (MethodGroupResolveResult)resolveResult; }
 
48
                }
 
49
                
 
50
                [Test]
 
51
                public void ResolveResultContainingTypeHasOneTanMethods()
 
52
                {
 
53
                        List<IMethod> tanMethods = GetTanMethods();
 
54
                        Assert.AreEqual(1, tanMethods.Count);
 
55
                }
 
56
                
 
57
                List<IMethod> GetTanMethods()
 
58
                {
 
59
                        List<IMethod> methods = MethodResolveResult.ContainingType.GetMethods();
 
60
                        return PythonCompletionItemsHelper.FindAllMethodsFromCollection("tan", -1, methods.ToArray());
 
61
                }
 
62
        }
 
63
}