1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.Core
.Tests
.Resources
18 using Castle
.Core
.Resource
;
19 using NUnit
.Framework
;
22 public class CustomUriTestCase
25 public void FileUris()
27 CustomUri uri1
= new CustomUri("file://c:\\mydir\\properties.config");
29 Assert
.AreEqual("c:/mydir/properties.config", uri1
.Path
);
30 Assert
.AreEqual(null, uri1
.Host
);
31 Assert
.AreEqual("file", uri1
.Scheme
);
32 Assert
.AreEqual(true, uri1
.IsFile
);
33 Assert
.AreEqual(false, uri1
.IsUnc
);
37 public void FileUris2()
39 CustomUri uri1
= new CustomUri("file://Config/properties.config");
41 Assert
.AreEqual("Config/properties.config", uri1
.Path
);
42 Assert
.AreEqual(null, uri1
.Host
);
43 Assert
.AreEqual("file", uri1
.Scheme
);
44 Assert
.AreEqual(true, uri1
.IsFile
);
45 Assert
.AreEqual(false, uri1
.IsUnc
);
49 public void FileUris3()
51 CustomUri uri1
= new CustomUri("e:\\somedir\\somefile.extension");
53 Assert
.AreEqual("e:/somedir/somefile.extension", uri1
.Path
);
54 Assert
.AreEqual(null, uri1
.Host
);
55 Assert
.AreEqual("file", uri1
.Scheme
);
56 Assert
.AreEqual(true, uri1
.IsFile
);
57 Assert
.AreEqual(false, uri1
.IsUnc
);
61 public void AssemblyUri()
63 CustomUri uri1
= new CustomUri("assembly://Assembly.Name/properties.config");
65 Assert
.AreEqual("/properties.config", uri1
.Path
);
66 Assert
.AreEqual("Assembly.Name", uri1
.Host
);
67 Assert
.AreEqual("assembly", uri1
.Scheme
);
68 Assert
.AreEqual(false, uri1
.IsFile
);
69 Assert
.AreEqual(false, uri1
.IsUnc
);
73 public void AssemblyUri2()
75 CustomUri uri1
= new CustomUri("assembly://Assembly.Name/Some/Namespace/properties.config");
77 Assert
.AreEqual("/Some/Namespace/properties.config", uri1
.Path
);
78 Assert
.AreEqual("Assembly.Name", uri1
.Host
);
79 Assert
.AreEqual("assembly", uri1
.Scheme
);
80 Assert
.AreEqual(false, uri1
.IsFile
);
81 Assert
.AreEqual(false, uri1
.IsUnc
);