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.
29 using System.Collections.Generic;
30 using System.Configuration;
31 using System.Configuration.Provider;
34 using System.Web.Hosting;
36 using StandAloneRunnerSupport;
37 using StandAloneTests;
39 using NUnit.Framework;
41 namespace StandAloneTests.BuildManagerCacheFiles
43 [TestCase ("BuildManagerCacheFiles 01", "Tests for BuildManager.{Create,Read}CacheFile")]
44 public sealed class BuildManagerCacheFiles_01 : ITestCase
46 static string[] expectedMessages = {
48 "create[1]: fileStream",
49 "create[1]: can read",
50 "create[1]: can write",
51 "create[1]: pathSubdirOfCodeGen",
52 "create[1]: our file name",
54 "read[1]: fileStream",
56 "read[1]: cannot write",
57 "read[1]: pathSubdirOfCodeGen",
58 "read[1]: our file name",
59 "read[1]: contents ok",
65 // System.ArgumentException: Value does not fall within the expected range.
66 // at System.Web.Compilation.BuildManager.GetUserCacheFilePath(String fileName)
67 // at System.Web.Compilation.BuildManager.CreateCachedFile(String fileName)
68 // 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)
69 "create[2]: error write (System.ArgumentException)",
74 // System.ArgumentException: Value does not fall within the expected range.
75 // at System.Web.Compilation.BuildManager.GetUserCacheFilePath(String fileName)
76 // at System.Web.Compilation.BuildManager.ReadCachedFile(String fileName)
77 // 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)
78 "read[2]: error read (System.ArgumentException)",
81 "read[3]: stream is null",
86 // System.ArgumentNullException: Value cannot be null.
87 // Parameter name: path2
88 // at System.IO.Path.Combine(String path1, String path2)
89 // at System.Web.Compilation.BuildManager.GetUserCacheFilePath(String fileName)
90 // at System.Web.Compilation.BuildManager.CreateCachedFile(String fileName)
91 // 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)
92 "create[4]: error write (System.ArgumentNullException)",
96 // System.ArgumentNullException: Value cannot be null.
97 // Parameter name: path2
98 // at System.IO.Path.Combine(String path1, String path2)
99 // at System.Web.Compilation.BuildManager.GetUserCacheFilePath(String fileName)
100 // at System.Web.Compilation.BuildManager.ReadCachedFile(String fileName)
101 // 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)
102 "read[4]: error read (System.ArgumentNullException)",
104 "create[5]: codeGen",
107 // System.ArgumentException: Value does not fall within the expected range.
108 // at System.Web.Compilation.BuildManager.GetUserCacheFilePath(String fileName)
109 // at System.Web.Compilation.BuildManager.CreateCachedFile(String fileName)
110 // 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)
111 "create[5]: error write (System.ArgumentException)",
116 // System.ArgumentException: Value does not fall within the expected range.
117 // at System.Web.Compilation.BuildManager.GetUserCacheFilePath(String fileName)
118 // at System.Web.Compilation.BuildManager.ReadCachedFile(String fileName)
119 // 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)
120 "read[5]: error read (System.ArgumentException)",
123 public string PhysicalPath {
125 return Path.Combine (
126 Consts.BasePhysicalDir,
127 "BuildManagerCacheFiles"
132 public string VirtualPath {
136 public bool SetUp (List <TestRunItem> runItems)
138 runItems.Add (new TestRunItem ("/Default.aspx", Default_Aspx));
143 void Default_Aspx (string result, TestRunItem runItem)
145 var messages = runItem.TestRunData as List <string>;
147 Assert.IsNotNull (messages, "#A1");
149 int len = messages.Count;
152 Assert.AreEqual (expectedMessages [i], messages [i], "#A2-" + i.ToString ());
155 Assert.Fail ("Expected {0} messages, found {1}", i, len);