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

« back to all changes in this revision

Viewing changes to src/ClientUtilities/tests/ProjectConfigTests.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
 
// This is free software licensed under the NUnit license. You
3
 
// may obtain a copy of the license as well as information regarding
4
 
// copyright ownership at http://nunit.org.
5
 
// ****************************************************************
6
 
 
7
 
using System;
8
 
using System.IO;
9
 
using System.Collections;
10
 
using NUnit.Framework;
11
 
 
12
 
namespace NUnit.Util.Tests
13
 
{
14
 
        /// <summary>
15
 
        /// Summary description for ProjectConfigTests.
16
 
        /// </summary>
17
 
        [TestFixture]
18
 
        public class ProjectConfigTests
19
 
        {
20
 
                private ProjectConfig activeConfig;
21
 
        private ProjectConfig inactiveConfig;
22
 
                private NUnitProject project;
23
 
 
24
 
                [SetUp]
25
 
                public void SetUp()
26
 
                {
27
 
                        activeConfig = new ProjectConfig( "Debug" );
28
 
            inactiveConfig = new ProjectConfig("Release");
29
 
                        project = new NUnitProject( TestPath( "/test/myproject.nunit" ) );
30
 
                        project.Configs.Add( activeConfig );
31
 
            project.Configs.Add(inactiveConfig);
32
 
            project.IsDirty = false;
33
 
            project.HasChangesRequiringReload = false;
34
 
                }
35
 
 
36
 
        /// <summary>
37
 
        /// Take a valid Linux filePath and make a valid windows filePath out of it
38
 
        /// if we are on Windows. Change slashes to backslashes and, if the
39
 
        /// filePath starts with a slash, add C: in front of it.
40
 
        /// </summary>
41
 
        private string TestPath(string path)
42
 
        {
43
 
            if (Path.DirectorySeparatorChar != '/')
44
 
            {
45
 
                path = path.Replace('/', Path.DirectorySeparatorChar);
46
 
                if (path[0] == Path.DirectorySeparatorChar)
47
 
                    path = "C:" + path;
48
 
            }
49
 
 
50
 
            return path;
51
 
        }
52
 
 
53
 
                [Test]
54
 
                public void EmptyConfig()
55
 
                {
56
 
                        Assert.AreEqual( "Debug", activeConfig.Name );
57
 
                        Assert.AreEqual( 0, activeConfig.Assemblies.Count );
58
 
                }
59
 
 
60
 
                [Test]
61
 
                public void CanAddAssemblies()
62
 
                {
63
 
            string path1 = TestPath("/test/assembly1.dll");
64
 
            string path2 = TestPath("/test/assembly2.dll");
65
 
            activeConfig.Assemblies.Add(path1);
66
 
                        activeConfig.Assemblies.Add( path2 );
67
 
                        Assert.AreEqual( 2, activeConfig.Assemblies.Count );
68
 
                        Assert.AreEqual( path1, activeConfig.Assemblies[0] );
69
 
                        Assert.AreEqual( path2, activeConfig.Assemblies[1] );
70
 
                }
71
 
 
72
 
                [Test]
73
 
                public void ToArray()
74
 
                {
75
 
            string path1 = TestPath("/test/assembly1.dll");
76
 
            string path2 = TestPath("/test/assembly2.dll");
77
 
            activeConfig.Assemblies.Add( path1 );
78
 
                        activeConfig.Assemblies.Add( path2 );
79
 
 
80
 
                        string[] files = activeConfig.Assemblies.ToArray();
81
 
                        Assert.AreEqual( path1, files[0] );
82
 
                        Assert.AreEqual( path2, files[1] );
83
 
                }
84
 
 
85
 
        [Test]
86
 
        public void AddToActiveConfigMarksProjectDirty()
87
 
        {
88
 
            activeConfig.Assemblies.Add(TestPath("/test/bin/debug/assembly1.dll"));
89
 
            Assert.IsTrue(project.IsDirty);
90
 
        }
91
 
 
92
 
        [Test]
93
 
        public void AddToActiveConfigRequiresReload()
94
 
        {
95
 
            activeConfig.Assemblies.Add(TestPath("/test/bin/debug/assembly1.dll"));
96
 
            Assert.IsTrue(project.HasChangesRequiringReload);
97
 
        }
98
 
 
99
 
        [Test]
100
 
        public void AddToInactiveConfigMarksProjectDirty()
101
 
        {
102
 
            inactiveConfig.Assemblies.Add(TestPath("/test/bin/release/assembly1.dll"));
103
 
            Assert.IsTrue(project.IsDirty);
104
 
        }
105
 
 
106
 
        [Test]
107
 
        public void AddToInactiveConfigDoesNotRequireReload()
108
 
        {
109
 
            inactiveConfig.Assemblies.Add(TestPath("/test/bin/release/assembly1.dll"));
110
 
            Assert.IsFalse(project.HasChangesRequiringReload);
111
 
        }
112
 
 
113
 
        [Test]
114
 
        public void AddingConfigMarksProjectDirty()
115
 
        {
116
 
            project.Configs.Add("New");
117
 
            Assert.IsTrue(project.IsDirty);
118
 
        }
119
 
 
120
 
        [Test]
121
 
        public void AddingInitialConfigRequiresReload()
122
 
        {
123
 
            NUnitProject newProj = new NUnitProject("/junk");
124
 
            newProj.HasChangesRequiringReload = false;
125
 
            newProj.Configs.Add("New");
126
 
            Assert.That(newProj.HasChangesRequiringReload);
127
 
        }
128
 
 
129
 
        [Test]
130
 
        public void AddingSubsequentConfigDoesNotRequireReload()
131
 
        {
132
 
            project.Configs.Add("New");
133
 
            Assert.IsFalse(project.HasChangesRequiringReload);
134
 
        }
135
 
 
136
 
        [Test]
137
 
        public void RenameActiveConfigMarksProjectDirty()
138
 
        {
139
 
            activeConfig.Name = "Renamed";
140
 
            Assert.IsTrue(project.IsDirty);
141
 
        }
142
 
 
143
 
        [Test]
144
 
        public void RenameActiveConfigRequiresReload()
145
 
        {
146
 
            activeConfig.Name = "Renamed";
147
 
            Assert.IsTrue(project.HasChangesRequiringReload);
148
 
        }
149
 
 
150
 
        [Test]
151
 
        public void RenameInctiveConfigMarksProjectDirty()
152
 
        {
153
 
            inactiveConfig.Name = "Renamed";
154
 
            Assert.IsTrue(project.IsDirty);
155
 
        }
156
 
 
157
 
        [Test]
158
 
        public void RenameInactiveConfigDoesNotRequireReload()
159
 
        {
160
 
            inactiveConfig.Name = "Renamed";
161
 
            Assert.IsFalse(project.HasChangesRequiringReload);
162
 
        }
163
 
 
164
 
        [Test]
165
 
        public void RemoveActiveConfigMarksProjectDirty()
166
 
        {
167
 
            string path1 = TestPath("/test/bin/debug/assembly1.dll");
168
 
            activeConfig.Assemblies.Add(path1);
169
 
            project.IsDirty = false;
170
 
            activeConfig.Assemblies.Remove(path1);
171
 
            Assert.IsTrue(project.IsDirty);
172
 
        }
173
 
 
174
 
        [Test]
175
 
        public void RemoveActiveConfigRequiresReload()
176
 
        {
177
 
            string path1 = TestPath("/test/bin/debug/assembly1.dll");
178
 
            activeConfig.Assemblies.Add(path1);
179
 
            project.IsDirty = false;
180
 
            activeConfig.Assemblies.Remove(path1);
181
 
            Assert.IsTrue(project.HasChangesRequiringReload);
182
 
        }
183
 
 
184
 
        [Test]
185
 
        public void RemoveInactiveConfigMarksProjectDirty()
186
 
        {
187
 
            string path1 = TestPath("/test/bin/debug/assembly1.dll");
188
 
            inactiveConfig.Assemblies.Add(path1);
189
 
            project.IsDirty = false;
190
 
            inactiveConfig.Assemblies.Remove(path1);
191
 
            Assert.IsTrue(project.IsDirty);
192
 
        }
193
 
 
194
 
        [Test]
195
 
        public void RemoveInactiveConfigDoesNotRequireReload()
196
 
        {
197
 
            string path1 = TestPath("/test/bin/debug/assembly1.dll");
198
 
            inactiveConfig.Assemblies.Add(path1);
199
 
            project.HasChangesRequiringReload = false;
200
 
            inactiveConfig.Assemblies.Remove(path1);
201
 
            Assert.IsFalse(project.HasChangesRequiringReload);
202
 
        }
203
 
 
204
 
        [Test]
205
 
        public void SettingActiveConfigApplicationBaseMarksProjectDirty()
206
 
        {
207
 
            activeConfig.BasePath = TestPath("/junk");
208
 
            Assert.IsTrue(project.IsDirty);
209
 
        }
210
 
 
211
 
        [Test]
212
 
        public void SettingActiveConfigApplicationBaseRequiresReload()
213
 
        {
214
 
            activeConfig.BasePath = TestPath("/junk");
215
 
            Assert.IsTrue(project.HasChangesRequiringReload);
216
 
        }
217
 
 
218
 
        [Test]
219
 
        public void SettingInactiveConfigApplicationBaseMarksProjectDirty()
220
 
        {
221
 
            inactiveConfig.BasePath = TestPath("/junk");
222
 
            Assert.IsTrue(project.IsDirty);
223
 
        }
224
 
 
225
 
        [Test]
226
 
        public void SettingInactiveConfigApplicationBaseDoesNotRequireReload()
227
 
        {
228
 
            inactiveConfig.BasePath = TestPath("/junk");
229
 
            Assert.IsFalse(project.HasChangesRequiringReload);
230
 
        }
231
 
 
232
 
        [Test]
233
 
                public void AbsoluteBasePath()
234
 
                {
235
 
            activeConfig.BasePath = TestPath("/junk");
236
 
            string path1 = TestPath( "/junk/bin/debug/assembly1.dll" );
237
 
                        activeConfig.Assemblies.Add( path1 );
238
 
                        Assert.AreEqual( path1, activeConfig.Assemblies[0] );
239
 
                }
240
 
 
241
 
                [Test]
242
 
                public void RelativeBasePath()
243
 
                {
244
 
                        activeConfig.BasePath = @"junk";
245
 
            string path1 = TestPath("/test/junk/bin/debug/assembly1.dll");
246
 
            activeConfig.Assemblies.Add( path1 );
247
 
                        Assert.AreEqual( path1, activeConfig.Assemblies[0] );
248
 
                }
249
 
 
250
 
                [Test]
251
 
                public void NoBasePathSet()
252
 
                {
253
 
            string path1 = TestPath( "/test/bin/debug/assembly1.dll" );
254
 
                        activeConfig.Assemblies.Add( path1 );
255
 
                        Assert.AreEqual( path1, activeConfig.Assemblies[0] );
256
 
                }
257
 
 
258
 
        [Test]
259
 
        public void SettingActiveConfigConfigurationFileMarksProjectDirty()
260
 
        {
261
 
            activeConfig.ConfigurationFile = "MyProject.config";
262
 
            Assert.IsTrue(project.IsDirty);
263
 
        }
264
 
 
265
 
        [Test]
266
 
        public void SettingActiveConfigConfigurationFileRequiresReload()
267
 
        {
268
 
            activeConfig.ConfigurationFile = "MyProject.config";
269
 
            Assert.IsTrue(project.HasChangesRequiringReload);
270
 
        }
271
 
 
272
 
        [Test]
273
 
        public void SettingInactiveConfigConfigurationFileMarksProjectDirty()
274
 
        {
275
 
            inactiveConfig.ConfigurationFile = "MyProject.config";
276
 
            Assert.IsTrue(project.IsDirty);
277
 
        }
278
 
 
279
 
        [Test]
280
 
        public void SettingInactiveConfigConfigurationFileDoesNotRequireReload()
281
 
        {
282
 
            inactiveConfig.ConfigurationFile = "MyProject.config";
283
 
            Assert.IsFalse(project.HasChangesRequiringReload);
284
 
        }
285
 
 
286
 
        [Test]
287
 
                public void DefaultConfigurationFile()
288
 
                {
289
 
                        Assert.AreEqual( "myproject.config", activeConfig.ConfigurationFile );
290
 
                        Assert.AreEqual( TestPath( "/test/myproject.config" ), activeConfig.ConfigurationFilePath );
291
 
                }
292
 
 
293
 
                [Test]
294
 
                public void AbsoluteConfigurationFile()
295
 
                {
296
 
            string path1 = TestPath("/configs/myconfig.config");
297
 
                        activeConfig.ConfigurationFile = path1;
298
 
                        Assert.AreEqual( path1, activeConfig.ConfigurationFilePath );
299
 
                }
300
 
 
301
 
                [Test]
302
 
                public void RelativeConfigurationFile()
303
 
                {
304
 
                        activeConfig.ConfigurationFile = "myconfig.config";
305
 
                        Assert.AreEqual( TestPath( "/test/myconfig.config" ), activeConfig.ConfigurationFilePath );
306
 
                }
307
 
 
308
 
        [Test]
309
 
        public void SettingActiveConfigPrivateBinPathMarksProjectDirty()
310
 
        {
311
 
            activeConfig.PrivateBinPath = TestPath("/junk") + Path.PathSeparator + TestPath("/bin");
312
 
            Assert.IsTrue(project.IsDirty);
313
 
        }
314
 
 
315
 
        [Test]
316
 
        public void SettingActiveConfigPrivateBinPathRequiresReload()
317
 
        {
318
 
            activeConfig.PrivateBinPath = TestPath("/junk") + Path.PathSeparator + TestPath("/bin");
319
 
            Assert.IsTrue(project.HasChangesRequiringReload);
320
 
        }
321
 
 
322
 
        [Test]
323
 
        public void SettingInactiveConfigPrivateBinPathMarksProjectDirty()
324
 
        {
325
 
            inactiveConfig.PrivateBinPath = TestPath("/junk") + Path.PathSeparator + TestPath("/bin");
326
 
            Assert.IsTrue(project.IsDirty);
327
 
        }
328
 
 
329
 
        [Test]
330
 
        public void SettingInactiveConfigPrivateBinPathDoesNotRequireReload()
331
 
        {
332
 
            inactiveConfig.PrivateBinPath = TestPath("/junk") + Path.PathSeparator + TestPath("/bin");
333
 
            Assert.IsFalse(project.HasChangesRequiringReload);
334
 
        }
335
 
 
336
 
        [Test]
337
 
        public void SettingActiveConfigBinPathTypeMarksProjectDirty()
338
 
        {
339
 
            activeConfig.BinPathType = BinPathType.Manual;
340
 
            Assert.IsTrue(project.IsDirty);
341
 
        }
342
 
 
343
 
        [Test]
344
 
        public void SettingActiveConfigBinPathTypeRequiresReload()
345
 
        {
346
 
            activeConfig.BinPathType = BinPathType.Manual;
347
 
            Assert.IsTrue(project.HasChangesRequiringReload);
348
 
        }
349
 
 
350
 
        [Test]
351
 
        public void SettingInactiveConfigBinPathTypeMarksProjectDirty()
352
 
        {
353
 
            inactiveConfig.BinPathType = BinPathType.Manual;
354
 
            Assert.IsTrue(project.IsDirty);
355
 
        }
356
 
 
357
 
        [Test]
358
 
        public void SettingInactiveConfigBinPathTypeDoesNotRequireReload()
359
 
        {
360
 
            inactiveConfig.BinPathType = BinPathType.Manual;
361
 
            Assert.IsFalse(project.HasChangesRequiringReload);
362
 
        }
363
 
 
364
 
                [Test]
365
 
                public void NoPrivateBinPath()
366
 
                {
367
 
                        activeConfig.Assemblies.Add( TestPath( "/bin/assembly1.dll" ) );
368
 
                        activeConfig.Assemblies.Add( TestPath( "/bin/assembly2.dll" ) );
369
 
                        activeConfig.BinPathType = BinPathType.None;
370
 
                        Assert.IsNull( activeConfig.PrivateBinPath );
371
 
                }
372
 
 
373
 
                [Test]
374
 
                public void ManualPrivateBinPath()
375
 
                {
376
 
                        activeConfig.Assemblies.Add( TestPath( "/test/bin/assembly1.dll" ) );
377
 
                        activeConfig.Assemblies.Add( TestPath( "/test/bin/assembly2.dll" ) );
378
 
                        activeConfig.BinPathType = BinPathType.Manual;
379
 
                        activeConfig.PrivateBinPath = TestPath( "/test" );
380
 
                        Assert.AreEqual( TestPath( "/test" ), activeConfig.PrivateBinPath );
381
 
                }
382
 
 
383
 
// TODO: Move to DomainManagerTests
384
 
//              [Test]
385
 
//              public void AutoPrivateBinPath()
386
 
//              {
387
 
//                      config.Assemblies.Add( TestPath( "/test/bin/assembly1.dll" ) );
388
 
//                      config.Assemblies.Add( TestPath( "/test/bin/assembly2.dll" ) );
389
 
//                      config.BinPathType = BinPathType.Auto;
390
 
//                      Assert.AreEqual( "bin", config.PrivateBinPath );
391
 
//              }
392
 
        }
393
 
}
 
1
// ****************************************************************
 
2
// This is free software licensed under the NUnit license. You
 
3
// may obtain a copy of the license as well as information regarding
 
4
// copyright ownership at http://nunit.org.
 
5
// ****************************************************************
 
6
 
 
7
using System;
 
8
using System.IO;
 
9
using System.Collections;
 
10
using NUnit.Framework;
 
11
 
 
12
namespace NUnit.Util.Tests
 
13
{
 
14
        /// <summary>
 
15
        /// Summary description for ProjectConfigTests.
 
16
        /// </summary>
 
17
        [TestFixture]
 
18
        public class ProjectConfigTests
 
19
        {
 
20
                private ProjectConfig activeConfig;
 
21
        private ProjectConfig inactiveConfig;
 
22
                private NUnitProject project;
 
23
 
 
24
                [SetUp]
 
25
                public void SetUp()
 
26
                {
 
27
                        activeConfig = new ProjectConfig( "Debug" );
 
28
            inactiveConfig = new ProjectConfig("Release");
 
29
                        project = new NUnitProject( TestPath( "/test/myproject.nunit" ) );
 
30
                        project.Configs.Add( activeConfig );
 
31
            project.Configs.Add(inactiveConfig);
 
32
            project.IsDirty = false;
 
33
            project.HasChangesRequiringReload = false;
 
34
                }
 
35
 
 
36
        /// <summary>
 
37
        /// Take a valid Linux filePath and make a valid windows filePath out of it
 
38
        /// if we are on Windows. Change slashes to backslashes and, if the
 
39
        /// filePath starts with a slash, add C: in front of it.
 
40
        /// </summary>
 
41
        private string TestPath(string path)
 
42
        {
 
43
            if (Path.DirectorySeparatorChar != '/')
 
44
            {
 
45
                path = path.Replace('/', Path.DirectorySeparatorChar);
 
46
                if (path[0] == Path.DirectorySeparatorChar)
 
47
                    path = "C:" + path;
 
48
            }
 
49
 
 
50
            return path;
 
51
        }
 
52
 
 
53
                [Test]
 
54
                public void EmptyConfig()
 
55
                {
 
56
                        Assert.AreEqual( "Debug", activeConfig.Name );
 
57
                        Assert.AreEqual( 0, activeConfig.Assemblies.Count );
 
58
                }
 
59
 
 
60
                [Test]
 
61
                public void CanAddAssemblies()
 
62
                {
 
63
            string path1 = TestPath("/test/assembly1.dll");
 
64
            string path2 = TestPath("/test/assembly2.dll");
 
65
            activeConfig.Assemblies.Add(path1);
 
66
                        activeConfig.Assemblies.Add( path2 );
 
67
                        Assert.AreEqual( 2, activeConfig.Assemblies.Count );
 
68
                        Assert.AreEqual( path1, activeConfig.Assemblies[0] );
 
69
                        Assert.AreEqual( path2, activeConfig.Assemblies[1] );
 
70
                }
 
71
 
 
72
                [Test]
 
73
                public void ToArray()
 
74
                {
 
75
            string path1 = TestPath("/test/assembly1.dll");
 
76
            string path2 = TestPath("/test/assembly2.dll");
 
77
            activeConfig.Assemblies.Add( path1 );
 
78
                        activeConfig.Assemblies.Add( path2 );
 
79
 
 
80
                        string[] files = activeConfig.Assemblies.ToArray();
 
81
                        Assert.AreEqual( path1, files[0] );
 
82
                        Assert.AreEqual( path2, files[1] );
 
83
                }
 
84
 
 
85
        [Test]
 
86
        public void AddToActiveConfigMarksProjectDirty()
 
87
        {
 
88
            activeConfig.Assemblies.Add(TestPath("/test/bin/debug/assembly1.dll"));
 
89
            Assert.IsTrue(project.IsDirty);
 
90
        }
 
91
 
 
92
        [Test]
 
93
        public void AddToActiveConfigRequiresReload()
 
94
        {
 
95
            activeConfig.Assemblies.Add(TestPath("/test/bin/debug/assembly1.dll"));
 
96
            Assert.IsTrue(project.HasChangesRequiringReload);
 
97
        }
 
98
 
 
99
        [Test]
 
100
        public void AddToInactiveConfigMarksProjectDirty()
 
101
        {
 
102
            inactiveConfig.Assemblies.Add(TestPath("/test/bin/release/assembly1.dll"));
 
103
            Assert.IsTrue(project.IsDirty);
 
104
        }
 
105
 
 
106
        [Test]
 
107
        public void AddToInactiveConfigDoesNotRequireReload()
 
108
        {
 
109
            inactiveConfig.Assemblies.Add(TestPath("/test/bin/release/assembly1.dll"));
 
110
            Assert.IsFalse(project.HasChangesRequiringReload);
 
111
        }
 
112
 
 
113
        [Test]
 
114
        public void AddingConfigMarksProjectDirty()
 
115
        {
 
116
            project.Configs.Add("New");
 
117
            Assert.IsTrue(project.IsDirty);
 
118
        }
 
119
 
 
120
        [Test]
 
121
        public void AddingInitialConfigRequiresReload()
 
122
        {
 
123
            NUnitProject newProj = new NUnitProject("/junk");
 
124
            newProj.HasChangesRequiringReload = false;
 
125
            newProj.Configs.Add("New");
 
126
            Assert.That(newProj.HasChangesRequiringReload);
 
127
        }
 
128
 
 
129
        [Test]
 
130
        public void AddingSubsequentConfigDoesNotRequireReload()
 
131
        {
 
132
            project.Configs.Add("New");
 
133
            Assert.IsFalse(project.HasChangesRequiringReload);
 
134
        }
 
135
 
 
136
        [Test]
 
137
        public void RenameActiveConfigMarksProjectDirty()
 
138
        {
 
139
            activeConfig.Name = "Renamed";
 
140
            Assert.IsTrue(project.IsDirty);
 
141
        }
 
142
 
 
143
        [Test]
 
144
        public void RenameActiveConfigRequiresReload()
 
145
        {
 
146
            activeConfig.Name = "Renamed";
 
147
            Assert.IsTrue(project.HasChangesRequiringReload);
 
148
        }
 
149
 
 
150
        [Test]
 
151
        public void RenameInctiveConfigMarksProjectDirty()
 
152
        {
 
153
            inactiveConfig.Name = "Renamed";
 
154
            Assert.IsTrue(project.IsDirty);
 
155
        }
 
156
 
 
157
        [Test]
 
158
        public void RenameInactiveConfigDoesNotRequireReload()
 
159
        {
 
160
            inactiveConfig.Name = "Renamed";
 
161
            Assert.IsFalse(project.HasChangesRequiringReload);
 
162
        }
 
163
 
 
164
        [Test]
 
165
        public void RemoveActiveConfigMarksProjectDirty()
 
166
        {
 
167
            string path1 = TestPath("/test/bin/debug/assembly1.dll");
 
168
            activeConfig.Assemblies.Add(path1);
 
169
            project.IsDirty = false;
 
170
            activeConfig.Assemblies.Remove(path1);
 
171
            Assert.IsTrue(project.IsDirty);
 
172
        }
 
173
 
 
174
        [Test]
 
175
        public void RemoveActiveConfigRequiresReload()
 
176
        {
 
177
            string path1 = TestPath("/test/bin/debug/assembly1.dll");
 
178
            activeConfig.Assemblies.Add(path1);
 
179
            project.IsDirty = false;
 
180
            activeConfig.Assemblies.Remove(path1);
 
181
            Assert.IsTrue(project.HasChangesRequiringReload);
 
182
        }
 
183
 
 
184
        [Test]
 
185
        public void RemoveInactiveConfigMarksProjectDirty()
 
186
        {
 
187
            string path1 = TestPath("/test/bin/debug/assembly1.dll");
 
188
            inactiveConfig.Assemblies.Add(path1);
 
189
            project.IsDirty = false;
 
190
            inactiveConfig.Assemblies.Remove(path1);
 
191
            Assert.IsTrue(project.IsDirty);
 
192
        }
 
193
 
 
194
        [Test]
 
195
        public void RemoveInactiveConfigDoesNotRequireReload()
 
196
        {
 
197
            string path1 = TestPath("/test/bin/debug/assembly1.dll");
 
198
            inactiveConfig.Assemblies.Add(path1);
 
199
            project.HasChangesRequiringReload = false;
 
200
            inactiveConfig.Assemblies.Remove(path1);
 
201
            Assert.IsFalse(project.HasChangesRequiringReload);
 
202
        }
 
203
 
 
204
        [Test]
 
205
        public void SettingActiveConfigApplicationBaseMarksProjectDirty()
 
206
        {
 
207
            activeConfig.BasePath = TestPath("/junk");
 
208
            Assert.IsTrue(project.IsDirty);
 
209
        }
 
210
 
 
211
        [Test]
 
212
        public void SettingActiveConfigApplicationBaseRequiresReload()
 
213
        {
 
214
            activeConfig.BasePath = TestPath("/junk");
 
215
            Assert.IsTrue(project.HasChangesRequiringReload);
 
216
        }
 
217
 
 
218
        [Test]
 
219
        public void SettingInactiveConfigApplicationBaseMarksProjectDirty()
 
220
        {
 
221
            inactiveConfig.BasePath = TestPath("/junk");
 
222
            Assert.IsTrue(project.IsDirty);
 
223
        }
 
224
 
 
225
        [Test]
 
226
        public void SettingInactiveConfigApplicationBaseDoesNotRequireReload()
 
227
        {
 
228
            inactiveConfig.BasePath = TestPath("/junk");
 
229
            Assert.IsFalse(project.HasChangesRequiringReload);
 
230
        }
 
231
 
 
232
        [Test]
 
233
                public void AbsoluteBasePath()
 
234
                {
 
235
            activeConfig.BasePath = TestPath("/junk");
 
236
            string path1 = TestPath( "/junk/bin/debug/assembly1.dll" );
 
237
                        activeConfig.Assemblies.Add( path1 );
 
238
                        Assert.AreEqual( path1, activeConfig.Assemblies[0] );
 
239
                }
 
240
 
 
241
                [Test]
 
242
                public void RelativeBasePath()
 
243
                {
 
244
                        activeConfig.BasePath = @"junk";
 
245
            string path1 = TestPath("/test/junk/bin/debug/assembly1.dll");
 
246
            activeConfig.Assemblies.Add( path1 );
 
247
                        Assert.AreEqual( path1, activeConfig.Assemblies[0] );
 
248
                }
 
249
 
 
250
                [Test]
 
251
                public void NoBasePathSet()
 
252
                {
 
253
            string path1 = TestPath( "/test/bin/debug/assembly1.dll" );
 
254
                        activeConfig.Assemblies.Add( path1 );
 
255
                        Assert.AreEqual( path1, activeConfig.Assemblies[0] );
 
256
                }
 
257
 
 
258
        [Test]
 
259
        public void SettingActiveConfigConfigurationFileMarksProjectDirty()
 
260
        {
 
261
            activeConfig.ConfigurationFile = "MyProject.config";
 
262
            Assert.IsTrue(project.IsDirty);
 
263
        }
 
264
 
 
265
        [Test]
 
266
        public void SettingActiveConfigConfigurationFileRequiresReload()
 
267
        {
 
268
            activeConfig.ConfigurationFile = "MyProject.config";
 
269
            Assert.IsTrue(project.HasChangesRequiringReload);
 
270
        }
 
271
 
 
272
        [Test]
 
273
        public void SettingInactiveConfigConfigurationFileMarksProjectDirty()
 
274
        {
 
275
            inactiveConfig.ConfigurationFile = "MyProject.config";
 
276
            Assert.IsTrue(project.IsDirty);
 
277
        }
 
278
 
 
279
        [Test]
 
280
        public void SettingInactiveConfigConfigurationFileDoesNotRequireReload()
 
281
        {
 
282
            inactiveConfig.ConfigurationFile = "MyProject.config";
 
283
            Assert.IsFalse(project.HasChangesRequiringReload);
 
284
        }
 
285
 
 
286
        [Test]
 
287
                public void DefaultConfigurationFile()
 
288
                {
 
289
                        Assert.AreEqual( "myproject.config", activeConfig.ConfigurationFile );
 
290
                        Assert.AreEqual( TestPath( "/test/myproject.config" ), activeConfig.ConfigurationFilePath );
 
291
                }
 
292
 
 
293
                [Test]
 
294
                public void AbsoluteConfigurationFile()
 
295
                {
 
296
            string path1 = TestPath("/configs/myconfig.config");
 
297
                        activeConfig.ConfigurationFile = path1;
 
298
                        Assert.AreEqual( path1, activeConfig.ConfigurationFilePath );
 
299
                }
 
300
 
 
301
                [Test]
 
302
                public void RelativeConfigurationFile()
 
303
                {
 
304
                        activeConfig.ConfigurationFile = "myconfig.config";
 
305
                        Assert.AreEqual( TestPath( "/test/myconfig.config" ), activeConfig.ConfigurationFilePath );
 
306
                }
 
307
 
 
308
        [Test]
 
309
        public void SettingActiveConfigPrivateBinPathMarksProjectDirty()
 
310
        {
 
311
            activeConfig.PrivateBinPath = TestPath("/junk") + Path.PathSeparator + TestPath("/bin");
 
312
            Assert.IsTrue(project.IsDirty);
 
313
        }
 
314
 
 
315
        [Test]
 
316
        public void SettingActiveConfigPrivateBinPathRequiresReload()
 
317
        {
 
318
            activeConfig.PrivateBinPath = TestPath("/junk") + Path.PathSeparator + TestPath("/bin");
 
319
            Assert.IsTrue(project.HasChangesRequiringReload);
 
320
        }
 
321
 
 
322
        [Test]
 
323
        public void SettingInactiveConfigPrivateBinPathMarksProjectDirty()
 
324
        {
 
325
            inactiveConfig.PrivateBinPath = TestPath("/junk") + Path.PathSeparator + TestPath("/bin");
 
326
            Assert.IsTrue(project.IsDirty);
 
327
        }
 
328
 
 
329
        [Test]
 
330
        public void SettingInactiveConfigPrivateBinPathDoesNotRequireReload()
 
331
        {
 
332
            inactiveConfig.PrivateBinPath = TestPath("/junk") + Path.PathSeparator + TestPath("/bin");
 
333
            Assert.IsFalse(project.HasChangesRequiringReload);
 
334
        }
 
335
 
 
336
        [Test]
 
337
        public void SettingActiveConfigBinPathTypeMarksProjectDirty()
 
338
        {
 
339
            activeConfig.BinPathType = BinPathType.Manual;
 
340
            Assert.IsTrue(project.IsDirty);
 
341
        }
 
342
 
 
343
        [Test]
 
344
        public void SettingActiveConfigBinPathTypeRequiresReload()
 
345
        {
 
346
            activeConfig.BinPathType = BinPathType.Manual;
 
347
            Assert.IsTrue(project.HasChangesRequiringReload);
 
348
        }
 
349
 
 
350
        [Test]
 
351
        public void SettingInactiveConfigBinPathTypeMarksProjectDirty()
 
352
        {
 
353
            inactiveConfig.BinPathType = BinPathType.Manual;
 
354
            Assert.IsTrue(project.IsDirty);
 
355
        }
 
356
 
 
357
        [Test]
 
358
        public void SettingInactiveConfigBinPathTypeDoesNotRequireReload()
 
359
        {
 
360
            inactiveConfig.BinPathType = BinPathType.Manual;
 
361
            Assert.IsFalse(project.HasChangesRequiringReload);
 
362
        }
 
363
 
 
364
                [Test]
 
365
                public void NoPrivateBinPath()
 
366
                {
 
367
                        activeConfig.Assemblies.Add( TestPath( "/bin/assembly1.dll" ) );
 
368
                        activeConfig.Assemblies.Add( TestPath( "/bin/assembly2.dll" ) );
 
369
                        activeConfig.BinPathType = BinPathType.None;
 
370
                        Assert.IsNull( activeConfig.PrivateBinPath );
 
371
                }
 
372
 
 
373
                [Test]
 
374
                public void ManualPrivateBinPath()
 
375
                {
 
376
                        activeConfig.Assemblies.Add( TestPath( "/test/bin/assembly1.dll" ) );
 
377
                        activeConfig.Assemblies.Add( TestPath( "/test/bin/assembly2.dll" ) );
 
378
                        activeConfig.BinPathType = BinPathType.Manual;
 
379
                        activeConfig.PrivateBinPath = TestPath( "/test" );
 
380
                        Assert.AreEqual( TestPath( "/test" ), activeConfig.PrivateBinPath );
 
381
                }
 
382
 
 
383
// TODO: Move to DomainManagerTests
 
384
//              [Test]
 
385
//              public void AutoPrivateBinPath()
 
386
//              {
 
387
//                      config.Assemblies.Add( TestPath( "/test/bin/assembly1.dll" ) );
 
388
//                      config.Assemblies.Add( TestPath( "/test/bin/assembly2.dll" ) );
 
389
//                      config.BinPathType = BinPathType.Auto;
 
390
//                      Assert.AreEqual( "bin", config.PrivateBinPath );
 
391
//              }
 
392
        }
 
393
}