Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
TestElement.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under Apache 2.0 License. See LICENSE.md for details.
3 //
4 // Copyright 2011-2012 Xamarin Inc.
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 //
10 // http://www.apache.org/licenses/LICENSE-2.0
11 //
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 //
18 
19 using System;
20 using NUnit.Framework.Api;
21 using NUnit.Framework.Internal;
22 using NUnitLite;
23 
24 namespace Android.NUnitLite.UI {
25 
26  abstract class TestElement : FormattedElement {
27 
28  string name;
29  ITestResult result;
30 
31  public TestElement (ITest test) : base (String.Empty)
32  {
33  if (test == null)
34  throw new ArgumentNullException ("test");
35 
36  Test = test;
37  name = test.FullName ?? test.Name;
38  Caption = GetCaption ();
39  }
40 
41  protected string Name {
42  get { return name; }
43  }
44 
45  protected ITestResult Result {
46  get {
47  AndroidRunner.Results.TryGetValue (name, out result);
48  return result;
49  }
50  }
51 
52  protected ITest Test { get; private set; }
53 
54  abstract protected string GetCaption ();
55 
56  public void Update ()
57  {
58  SetCaption (GetCaption ());
59  }
60  }
61 }