~nunit-core/nunitv2/2.5

« back to all changes in this revision

Viewing changes to src/ConsoleRunner/tests/ConsoleRunnerTest.cs

  • Committer: Charlie Poole
  • Date: 2011-03-26 01:59:26 UTC
  • Revision ID: charlie@nunit.org-20110326015926-mvnyv2z3af092j1q
Fix error in creating trace file

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
                [Test]
89
89
                public void InvalidFixture()
90
90
                {
91
 
                        int resultCode = executeConsole( new string[] 
92
 
                                { MockAssembly.AssemblyPath, "-fixture:NUnit.Tests.BogusTest" } );
 
91
                        int resultCode = executeConsole( new string[] { MockAssembly.AssemblyPath, "-fixture:NUnit.Tests.BogusTest", "-trace:Off" });
93
92
                        Assert.AreEqual(ConsoleUi.FIXTURE_NOT_FOUND, resultCode);
94
93
                }
95
94
 
96
95
                [Test]
97
96
                public void AssemblyNotFound()
98
97
                {
99
 
            int resultCode = executeConsole(new string[] { "badassembly.dll" });
 
98
            int resultCode = executeConsole(new string[] { "badassembly.dll", "-trace:Off" });
100
99
            Assert.AreEqual(ConsoleUi.FILE_NOT_FOUND, resultCode);
101
100
        }
102
101
 
103
102
        [Test]
104
103
        public void OneOfTwoAssembliesNotFound()
105
104
        {
106
 
            int resultCode = executeConsole(new string[] { GetType().Module.Name, "badassembly.dll" });
 
105
            int resultCode = executeConsole(new string[] { GetType().Module.Name, "badassembly.dll", "-trace:Off" });
107
106
            Assert.AreEqual(ConsoleUi.FILE_NOT_FOUND, resultCode);
108
107
        }
109
108
 
137
136
                [Test]
138
137
                public void CanRunWithoutTestDomain()
139
138
                {
140
 
            Assert.AreEqual(MockAssembly.ErrorsAndFailures, executeConsole(MockAssembly.AssemblyPath, "-domain:None", "-process:single"));
 
139
            Assert.AreEqual(MockAssembly.ErrorsAndFailures, executeConsole(MockAssembly.AssemblyPath, "-domain:None", "-process:single", "-trace:Off"));
141
140
                        StringAssert.Contains( failureMsg, output.ToString() );
142
141
                }
143
142
 
144
143
                [Test]
145
144
                public void CanRunWithSingleTestDomain()
146
145
                {
147
 
            Assert.AreEqual(MockAssembly.ErrorsAndFailures, executeConsole(MockAssembly.AssemblyPath, "-domain:Single", "-process:single"));
 
146
            Assert.AreEqual(MockAssembly.ErrorsAndFailures, executeConsole(MockAssembly.AssemblyPath, "-domain:Single", "-process:single", "-trace:Off"));
148
147
                        StringAssert.Contains( failureMsg, output.ToString() );
149
148
                }
150
149
 
151
150
                [Test]
152
151
                public void CanRunWithMultipleTestDomains()
153
152
                {
154
 
            Assert.AreEqual(MockAssembly.ErrorsAndFailures, executeConsole(MockAssembly.AssemblyPath, NoNamespaceTestFixture.AssemblyPath, "-domain:Multiple", "-process:single"));
 
153
            Assert.AreEqual(MockAssembly.ErrorsAndFailures, executeConsole(MockAssembly.AssemblyPath, NoNamespaceTestFixture.AssemblyPath, "-domain:Multiple", "-process:single", "-trace:Off"));
155
154
                        StringAssert.Contains( failureMsg, output.ToString() );
156
155
                }
157
156
 
158
157
                [Test]
159
158
                public void CanRunWithoutTestDomain_NoThread()
160
159
                {
161
 
            Assert.AreEqual(MockAssembly.ErrorsAndFailures, executeConsole(MockAssembly.AssemblyPath, "-domain:None", "-nothread", "-process:single"));
 
160
            Assert.AreEqual(MockAssembly.ErrorsAndFailures, executeConsole(MockAssembly.AssemblyPath, "-domain:None", "-nothread", "-process:single", "-trace:Off"));
162
161
                        StringAssert.Contains( failureMsg, output.ToString() );
163
162
                }
164
163
 
165
164
                [Test]
166
165
                public void CanRunWithSingleTestDomain_NoThread()
167
166
                {
168
 
            Assert.AreEqual(MockAssembly.ErrorsAndFailures, executeConsole(MockAssembly.AssemblyPath, "-domain:Single", "-nothread", "-process:single"));
 
167
            Assert.AreEqual(MockAssembly.ErrorsAndFailures, executeConsole(MockAssembly.AssemblyPath, "-domain:Single", "-nothread", "-process:single", "-trace:Off"));
169
168
                        StringAssert.Contains( failureMsg, output.ToString() );
170
169
                }
171
170
 
172
171
                [Test]
173
172
                public void CanRunWithMultipleTestDomains_NoThread()
174
173
                {
175
 
            Assert.AreEqual(MockAssembly.ErrorsAndFailures, executeConsole(MockAssembly.AssemblyPath, NoNamespaceTestFixture.AssemblyPath, "-domain:Multiple", "-nothread", "-process:single"));
 
174
            Assert.AreEqual(MockAssembly.ErrorsAndFailures, executeConsole(MockAssembly.AssemblyPath, NoNamespaceTestFixture.AssemblyPath, "-domain:Multiple", "-nothread", "-process:single", "-trace:Off"));
176
175
                        StringAssert.Contains( failureMsg, output.ToString() );
177
176
                }
178
177
 
179
178
                private int runFixture( Type type )
180
179
                {
181
 
                        return executeConsole( new string[] { AssemblyHelper.GetAssemblyPath(type), "-process:single", "-fixture:" + type.FullName });
 
180
                        return executeConsole( new string[] { AssemblyHelper.GetAssemblyPath(type), "-trace:Off", "-process:single", "-fixture:" + type.FullName });
182
181
                }
183
182
 
184
183
                private int runFixture( Type type, params string[] arguments )
185
184
                {
186
 
                        string[] args = new string[arguments.Length+3];
 
185
                        string[] args = new string[arguments.Length+4];
187
186
                        int n = 0;
188
187
                        args[n++] = AssemblyHelper.GetAssemblyPath(type);
 
188
            args[n++] = "-trace:Off";
189
189
            args[n++] = "-process:single";
190
190
                        args[n++] = "-fixture:" + type.FullName;
191
191
                        foreach( string arg in arguments )