~ubuntu-branches/debian/sid/nunit/sid

« back to all changes in this revision

Viewing changes to src/NUnitCore/tests/TestInfoTests.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2014-09-16 13:43:36 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20140916134336-kjxz48tty6lx2ja5
Tags: 2.6.3+dfsg-1
* [c7bd1b5] Imported Upstream version 2.6.3+dfsg
* [bcb4bf8] Move nunit-console-runner to GAC-installed libnunit2.6, 
  don't treat it as a private lib. This lib is signed, and treated 
  as a GAC lib by consumers such as MonoDevelop.
* [7f08e99] Bump version to 2.6.3 as required
* [84535eb] Refreshed patches
* [8479f61] Split package up into per-assembly packages. This makes 
  ABI tracking easier in the future, as we can meaningfully have GAC 
  policy for cases where ABI isn't truly bumped, and no policy for 
  cases where it is. For example, if nunit.framework bumps ABI but 
  nunit.core does not, previously we would need to rebuild everything 
  using NUnit, but under the new split packaging, that rebuild would 
  not be needed for apps only using nunit.core.
* [17a7dc7] Add missing nunit.mocks.dll to nunit.pc

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// ****************************************************************
2
 
// Copyright 2007, Charlie Poole
3
 
// This is free software licensed under the NUnit license. You may
4
 
// obtain a copy of the license at http://nunit.org
5
 
// ****************************************************************
6
 
 
7
 
using System;
8
 
using NUnit.Framework;
9
 
using NUnit.Tests.Assemblies;
10
 
using NUnit.TestUtilities;
11
 
 
12
 
namespace NUnit.Core.Tests
13
 
{
14
 
        /// <summary>
15
 
        /// Summary description for TestInfoTests.
16
 
        /// </summary>
17
 
        [TestFixture]
18
 
        public class TestInfoTests
19
 
        {
20
 
                TestSuite testSuite;
21
 
                TestSuite testFixture;
22
 
                Test testCase1;
23
 
 
24
 
                [SetUp]
25
 
                public void SetUp()
26
 
                {
27
 
                        testSuite = new TestSuite("MyTestSuite");
28
 
                        testFixture = TestBuilder.MakeFixture( typeof( MockTestFixture ) );
29
 
                        testSuite.Add( testFixture );
30
 
 
31
 
                        testCase1 = (Test)testFixture.Tests[0];
32
 
                }
33
 
 
34
 
                private void CheckConstructionFromTest( ITest expected )
35
 
                {
36
 
                        TestInfo actual = new TestInfo( expected );
37
 
                        Assert.AreEqual( expected.TestName, actual.TestName );
38
 
                        Assert.AreEqual( expected.TestType, actual.TestType );
39
 
                        Assert.AreEqual( expected.RunState, actual.RunState );
40
 
                        Assert.AreEqual( expected.IsSuite, actual.IsSuite, "IsSuite" );
41
 
                        Assert.AreEqual( expected.TestCount, actual.TestCount, "TestCount" );
42
 
 
43
 
                        if ( expected.Categories == null )
44
 
                                Assert.AreEqual( 0, actual.Categories.Count, "Categories" );
45
 
                        else
46
 
                        {
47
 
                                Assert.AreEqual( expected.Categories.Count, actual.Categories.Count, "Categories" );
48
 
                                for ( int index = 0; index < expected.Categories.Count; index++ )
49
 
                                        Assert.AreEqual( expected.Categories[index], actual.Categories[index], "Category {0}", index );
50
 
                        }
51
 
 
52
 
                        Assert.AreEqual( expected.TestName, actual.TestName, "TestName" );
53
 
                }
54
 
 
55
 
                [Test]
56
 
                public void ConstructFromFixture()
57
 
                {
58
 
                        CheckConstructionFromTest( testFixture );
59
 
                }
60
 
 
61
 
                [Test]
62
 
                public void ConstructFromSuite()
63
 
                {
64
 
                        CheckConstructionFromTest( testSuite );
65
 
                }
66
 
 
67
 
                [Test]
68
 
                public void ConstructFromTestCase()
69
 
                {
70
 
                        CheckConstructionFromTest( testCase1 );
71
 
                }
72
 
        }
73
 
}
 
1
// ****************************************************************
 
2
// Copyright 2007, Charlie Poole
 
3
// This is free software licensed under the NUnit license. You may
 
4
// obtain a copy of the license at http://nunit.org
 
5
// ****************************************************************
 
6
 
 
7
using System;
 
8
using NUnit.Framework;
 
9
using NUnit.Tests.Assemblies;
 
10
using NUnit.TestUtilities;
 
11
 
 
12
namespace NUnit.Core.Tests
 
13
{
 
14
        /// <summary>
 
15
        /// Summary description for TestInfoTests.
 
16
        /// </summary>
 
17
        [TestFixture]
 
18
        public class TestInfoTests
 
19
        {
 
20
                TestSuite testSuite;
 
21
                TestSuite testFixture;
 
22
                Test testCase1;
 
23
 
 
24
                [SetUp]
 
25
                public void SetUp()
 
26
                {
 
27
                        testSuite = new TestSuite("MyTestSuite");
 
28
                        testFixture = TestBuilder.MakeFixture( typeof( MockTestFixture ) );
 
29
                        testSuite.Add( testFixture );
 
30
 
 
31
                        testCase1 = (Test)testFixture.Tests[0];
 
32
                }
 
33
 
 
34
                private void CheckConstructionFromTest( ITest expected, string expectedClassName, string expectedMethodName )
 
35
                {
 
36
                        TestInfo actual = new TestInfo( expected );
 
37
                        Assert.AreEqual( expected.TestName, actual.TestName );
 
38
                        Assert.AreEqual( expected.TestType, actual.TestType );
 
39
                        Assert.AreEqual( expected.RunState, actual.RunState );
 
40
                        Assert.AreEqual( expected.IsSuite, actual.IsSuite, "IsSuite" );
 
41
                        Assert.AreEqual( expected.TestCount, actual.TestCount, "TestCount" );
 
42
 
 
43
            Assert.AreEqual(expectedClassName, actual.ClassName);
 
44
            Assert.AreEqual(expectedMethodName, actual.MethodName);
 
45
            
 
46
            if (expected.Categories == null)
 
47
                                Assert.AreEqual( 0, actual.Categories.Count, "Categories" );
 
48
                        else
 
49
                        {
 
50
                                Assert.AreEqual( expected.Categories.Count, actual.Categories.Count, "Categories" );
 
51
                                for ( int index = 0; index < expected.Categories.Count; index++ )
 
52
                                        Assert.AreEqual( expected.Categories[index], actual.Categories[index], "Category {0}", index );
 
53
                        }
 
54
 
 
55
                        Assert.AreEqual( expected.TestName, actual.TestName, "TestName" );
 
56
                }
 
57
 
 
58
                [Test]
 
59
                public void ConstructFromFixture()
 
60
                {
 
61
                        CheckConstructionFromTest( testFixture, "NUnit.Tests.Assemblies.MockTestFixture", null );
 
62
                }
 
63
 
 
64
                [Test]
 
65
                public void ConstructFromSuite()
 
66
                {
 
67
                        CheckConstructionFromTest( testSuite, null, null );
 
68
                }
 
69
 
 
70
                [Test]
 
71
                public void ConstructFromTestCase()
 
72
                {
 
73
                        CheckConstructionFromTest( testCase1, "NUnit.Tests.Assemblies.MockTestFixture", "MockTest1" );
 
74
                }
 
75
        }
 
76
}