3 // Marek Habersack (mhabersack@novell.com)
5 // (C) 2010 Novell, Inc http://novell.com/
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 using System.Collections.Generic;
31 using System.Configuration;
32 using System.Configuration.Provider;
35 using System.Web.Hosting;
37 using StandAloneRunnerSupport;
38 using StandAloneTests;
40 using NUnit.Framework;
42 namespace StandAloneTests.BuildManagerCacheFiles
44 [TestCase ("BuildManagerCacheFiles 01", "Tests for BuildManager.{Create,Read}CacheFile")]
45 public sealed class BuildManagerCacheFiles_01 : ITestCase
47 static string[] expectedMessages = {
49 "create[1]: fileStream",
50 "create[1]: can read",
51 "create[1]: can write",
52 "create[1]: pathSubdirOfCodeGen",
53 "create[1]: our file name",
55 "read[1]: fileStream",
57 "read[1]: cannot write",
58 "read[1]: pathSubdirOfCodeGen",
59 "read[1]: our file name",
60 "read[1]: contents ok",
66 // System.ArgumentException: Value does not fall within the expected range.
67 // at System.Web.Compilation.BuildManager.GetUserCacheFilePath(String fileName)
68 // at System.Web.Compilation.BuildManager.CreateCachedFile(String fileName)
69 // at _Default.RunTest(String fileName, String logTag, List`1 messages, Boolean noCreate) in c:\Users\grendel\Documents\Visual Studio 2010\Websites\BuildManager4.0\Default.aspx.cs:line 56)
70 "create[2]: error write (System.ArgumentException)",
75 // System.ArgumentException: Value does not fall within the expected range.
76 // at System.Web.Compilation.BuildManager.GetUserCacheFilePath(String fileName)
77 // at System.Web.Compilation.BuildManager.ReadCachedFile(String fileName)
78 // at _Default.RunTest(String fileName, String logTag, List`1 messages, Boolean noCreate) in c:\Users\grendel\Documents\Visual Studio 2010\Websites\BuildManager4.0\Default.aspx.cs:line 86)
79 "read[2]: error read (System.ArgumentException)",
82 "read[3]: stream is null",
87 // System.ArgumentNullException: Value cannot be null.
88 // Parameter name: path2
89 // at System.IO.Path.Combine(String path1, String path2)
90 // at System.Web.Compilation.BuildManager.GetUserCacheFilePath(String fileName)
91 // at System.Web.Compilation.BuildManager.CreateCachedFile(String fileName)
92 // at _Default.RunTest(String fileName, String logTag, List`1 messages, Boolean noCreate) in c:\Users\grendel\Documents\Visual Studio 2010\Websites\BuildManager4.0\Default.aspx.cs:line 61)
93 "create[4]: error write (System.ArgumentNullException)",
97 // System.ArgumentNullException: Value cannot be null.
98 // Parameter name: path2
99 // at System.IO.Path.Combine(String path1, String path2)
100 // at System.Web.Compilation.BuildManager.GetUserCacheFilePath(String fileName)
101 // at System.Web.Compilation.BuildManager.ReadCachedFile(String fileName)
102 // at _Default.RunTest(String fileName, String logTag, List`1 messages, Boolean noCreate) in c:\Users\grendel\Documents\Visual Studio 2010\Websites\BuildManager4.0\Default.aspx.cs:line 91)
103 "read[4]: error read (System.ArgumentNullException)",
105 "create[5]: codeGen",
108 // System.ArgumentException: Value does not fall within the expected range.
109 // at System.Web.Compilation.BuildManager.GetUserCacheFilePath(String fileName)
110 // at System.Web.Compilation.BuildManager.CreateCachedFile(String fileName)
111 // at _Default.RunTest(String fileName, String logTag, List`1 messages, Boolean noCreate) in c:\Users\grendel\Documents\Visual Studio 2010\Websites\BuildManager4.0\Default.aspx.cs:line 61)
112 "create[5]: error write (System.ArgumentException)",
117 // System.ArgumentException: Value does not fall within the expected range.
118 // at System.Web.Compilation.BuildManager.GetUserCacheFilePath(String fileName)
119 // at System.Web.Compilation.BuildManager.ReadCachedFile(String fileName)
120 // at _Default.RunTest(String fileName, String logTag, List`1 messages, Boolean noCreate) in c:\Users\grendel\Documents\Visual Studio 2010\Websites\BuildManager4.0\Default.aspx.cs:line 91)
121 "read[5]: error read (System.ArgumentException)",
124 public string PhysicalPath {
126 return Path.Combine (
127 Consts.BasePhysicalDir,
128 "BuildManagerCacheFiles"
133 public string VirtualPath {
137 public bool SetUp (List <TestRunItem> runItems)
139 runItems.Add (new TestRunItem ("/Default.aspx", Default_Aspx));
144 void Default_Aspx (string result, TestRunItem runItem)
146 var messages = runItem.TestRunData as List <string>;
148 Assert.IsNotNull (messages, "#A1");
150 int len = messages.Count;
153 Assert.AreEqual (expectedMessages [i], messages [i], "#A2-" + i.ToString ());
156 Assert.Fail ("Expected {0} messages, found {1}", i, len);