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

« back to all changes in this revision

Viewing changes to external/maccore/tests/bindings/ApiBaseTest.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
// Base test fixture for introspection tests
 
3
//
 
4
// Authors:
 
5
//      Sebastien Pouliot  <sebastien@xamarin.com>
 
6
//
 
7
// Copyright 2012-2013 Xamarin Inc.
 
8
//
 
9
// Licensed under the Apache License, Version 2.0 (the "License");
 
10
// you may not use this file except in compliance with the License.
 
11
// You may obtain a copy of the License at
 
12
//
 
13
//   http://www.apache.org/licenses/LICENSE-2.0
 
14
//
 
15
// Unless required by applicable law or agreed to in writing, software
 
16
// distributed under the License is distributed on an "AS IS" BASIS,
 
17
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
18
// See the License for the specific language governing permissions and
 
19
// limitations under the License.
 
20
//
 
21
 
 
22
using System;
 
23
using System.Reflection;
 
24
 
 
25
#if MONOMAC
 
26
using MonoMac.Foundation;
 
27
#else
 
28
using MonoTouch.Foundation;
 
29
#endif
 
30
 
 
31
namespace TouchUnit.Bindings {
 
32
        
 
33
        public abstract class ApiBaseTest {
 
34
                
 
35
                /// <summary>
 
36
                /// Gets or sets a value indicating whether this test fixture will continue after failures.
 
37
                /// </summary>
 
38
                /// <value>
 
39
                /// <c>true</c> if continue on failure; otherwise, <c>false</c>.
 
40
                /// </value>
 
41
                public bool ContinueOnFailure { get; set; }
 
42
                
 
43
                /// <summary>
 
44
                /// Gets or sets a value indicating whether this test fixture will log it's progress.
 
45
                /// </summary>
 
46
                /// <value>
 
47
                /// <c>true</c> if log progress; otherwise, <c>false</c>.
 
48
                /// </value>
 
49
                public bool LogProgress { get; set; }
 
50
                
 
51
                static protected Type NSObjectType = typeof (NSObject);
 
52
 
 
53
                protected virtual bool Skip (Attribute attribute)
 
54
                {
 
55
                        return false;
 
56
                }
 
57
 
 
58
                protected bool SkipDueToAttribute (MemberInfo member)
 
59
                {
 
60
                        if (member == null)
 
61
                                return false;
 
62
 
 
63
                        foreach (Attribute attr in member.GetCustomAttributes (true)) {
 
64
                                if (Skip (attr))
 
65
                                        return true;
 
66
                        }
 
67
 
 
68
                        return false;
 
69
                }
 
70
 
 
71
                /// <summary>
 
72
                /// Gets the assembly on which the test fixture will reflect the NSObject-derived types.
 
73
                /// The default implementation returns the assembly where NSObject is defined, e.g.
 
74
                /// monotouch.dll or xammac.dll. 
 
75
                /// You need to override this method to return the binding assembly you wish to test.
 
76
                /// </summary>
 
77
                /// <value>
 
78
                /// The assembly on which the fixture will execute it's tests.
 
79
                /// </value>
 
80
                protected virtual Assembly Assembly {
 
81
                        get { return NSObjectType.Assembly; }
 
82
                }
 
83
        }
 
84
}