Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 141b312

Browse files
committed
Merge pull request #2472 from JeremyKuhne/CommonTest
Add test project for common shared code.
2 parents 5b60b47 + cb0694e commit 141b312

File tree

7 files changed

+1532
-0
lines changed

7 files changed

+1532
-0
lines changed

src/Common/Common.Tests.sln

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.23107.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Tests", "tests\Common.Tests.csproj", "{C72FD34C-539A-4447-9796-62A229571199}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{C72FD34C-539A-4447-9796-62A229571199}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{C72FD34C-539A-4447-9796-62A229571199}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{C72FD34C-539A-4447-9796-62A229571199}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{C72FD34C-539A-4447-9796-62A229571199}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal

src/Common/tests/Common.Tests.csproj

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
3+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
4+
<PropertyGroup>
5+
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
6+
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
7+
<ProjectGuid>{C72FD34C-539A-4447-9796-62A229571199}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AssemblyName>Common.Tests</AssemblyName>
10+
<TestCategories>InnerLoop;OuterLoop</TestCategories>
11+
</PropertyGroup>
12+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
13+
<DebugSymbols>true</DebugSymbols>
14+
<PlatformTarget>AnyCPU</PlatformTarget>
15+
</PropertyGroup>
16+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
17+
<PlatformTarget>AnyCPU</PlatformTarget>
18+
</PropertyGroup>
19+
<ItemGroup>
20+
<None Include="project.json" />
21+
</ItemGroup>
22+
<ItemGroup>
23+
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
24+
</ItemGroup>
25+
<ItemGroup>
26+
<Compile Include="..\src\System\IO\PathInternal.cs">
27+
<Link>Common\System\IO\PathInternal.cs</Link>
28+
</Compile>
29+
<Compile Include="..\src\System\IO\StringBuilderCache.cs">
30+
<Link>Common\System\IO\StringBuilderCache.cs</Link>
31+
</Compile>
32+
<Compile Include="..\src\System\IO\StringParser.cs">
33+
<Link>Common\System\IO\StringParser.cs</Link>
34+
</Compile>
35+
<Compile Include="..\src\System\IO\TaskHelpers.cs">
36+
<Link>Common\System\IO\TaskHelpers.cs</Link>
37+
</Compile>
38+
</ItemGroup>
39+
<ItemGroup Condition="'$(TargetsWindows)'=='true'">
40+
<Compile Include="..\src\System\IO\PathInternal.Windows.cs">
41+
<Link>Common\System\IO\PathInternal.Windows.cs</Link>
42+
</Compile>
43+
<Compile Include="..\src\System\IO\PathInternal.CaseSensitive.cs">
44+
<Link>Common\System\IO\PathInternal.CaseSensitive.cs</Link>
45+
</Compile>
46+
<Compile Include="Tests\System\IO\PathInternal.Windows.Tests.cs" />
47+
</ItemGroup>
48+
<ItemGroup Condition="'$(TargetsUnix)'=='true'">
49+
<Compile Include="..\src\System\IO\PathInternal.Unix.cs">
50+
<Link>Common\System\IO\PathInternal.Unix.cs</Link>
51+
</Compile>
52+
<Compile Include="..\src\System\IO\PathInternal.CaseInsensitive.cs">
53+
<Link>Common\System\IO\PathInternal.CaseInsensitive.cs</Link>
54+
</Compile>
55+
</ItemGroup>
56+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
57+
</Project>

src/Common/tests/Resources/Strings.Designer.cs

Lines changed: 73 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<root>
3+
<!--
4+
Microsoft ResX Schema
5+
6+
Version 1.3
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
11+
associated with the data types.
12+
13+
Example:
14+
15+
... ado.net/XML headers & schema ...
16+
<resheader name="resmimetype">text/microsoft-resx</resheader>
17+
<resheader name="version">1.3</resheader>
18+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20+
<data name="Name1">this is my long string</data>
21+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23+
[base64 mime encoded serialized .NET Framework object]
24+
</data>
25+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26+
[base64 mime encoded string representing a byte array form of the .NET Framework object]
27+
</data>
28+
29+
There are any number of "resheader" rows that contain simple
30+
name/value pairs.
31+
32+
Each data row contains a name, and value. The row also contains a
33+
type or mimetype. Type corresponds to a .NET class that support
34+
text/value conversion through the TypeConverter architecture.
35+
Classes that don't support this are serialized and stored with the
36+
mimetype set.
37+
38+
The mimetype is used for serialized objects, and tells the
39+
ResXResourceReader how to depersist the object. This is currently not
40+
extensible. For a given mimetype the value must be set accordingly:
41+
42+
Note - application/x-microsoft.net.object.binary.base64 is the format
43+
that the ResXResourceWriter will generate, however the reader can
44+
read any of the formats listed below.
45+
46+
mimetype: application/x-microsoft.net.object.binary.base64
47+
value : The object must be serialized with
48+
: System.Serialization.Formatters.Binary.BinaryFormatter
49+
: and then encoded with base64 encoding.
50+
51+
mimetype: application/x-microsoft.net.object.soap.base64
52+
value : The object must be serialized with
53+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
54+
: and then encoded with base64 encoding.
55+
56+
mimetype: application/x-microsoft.net.object.bytearray.base64
57+
value : The object must be serialized into a byte array
58+
: using a System.ComponentModel.TypeConverter
59+
: and then encoded with base64 encoding.
60+
-->
61+
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:element name="root" msdata:IsDataSet="true">
64+
<xsd:complexType>
65+
<xsd:choice maxOccurs="unbounded">
66+
<xsd:element name="data">
67+
<xsd:complexType>
68+
<xsd:sequence>
69+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
70+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
71+
</xsd:sequence>
72+
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
73+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
74+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
75+
</xsd:complexType>
76+
</xsd:element>
77+
<xsd:element name="resheader">
78+
<xsd:complexType>
79+
<xsd:sequence>
80+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
81+
</xsd:sequence>
82+
<xsd:attribute name="name" type="xsd:string" use="required" />
83+
</xsd:complexType>
84+
</xsd:element>
85+
</xsd:choice>
86+
</xsd:complexType>
87+
</xsd:element>
88+
</xsd:schema>
89+
<resheader name="resmimetype">
90+
<value>text/microsoft-resx</value>
91+
</resheader>
92+
<resheader name="version">
93+
<value>1.3</value>
94+
</resheader>
95+
<resheader name="reader">
96+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
97+
</resheader>
98+
<resheader name="writer">
99+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
100+
</resheader>
101+
<data name="Argument_InvalidPathChars" xml:space="preserve">
102+
<value>Illegal characters in path.</value>
103+
</data>
104+
</root>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using System;
5+
using System.IO;
6+
using Xunit;
7+
8+
public class PathInternal_Windows_Tests
9+
{
10+
[Theory]
11+
[InlineData(PathInternal.ExtendedPathPrefix, PathInternal.ExtendedPathPrefix)]
12+
[InlineData(@"Foo", PathInternal.ExtendedPathPrefix + @"Foo")]
13+
[InlineData(@"\\Server\Share", PathInternal.UncExtendedPathPrefix + @"Server\Share")]
14+
[PlatformSpecific(PlatformID.Windows)]
15+
public void AddExtendedPathPrefixTest(string path, string expected)
16+
{
17+
Assert.Equal(expected, PathInternal.AddExtendedPathPrefix(path));
18+
}
19+
}

src/Common/tests/project.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"dependencies": {
3+
"System.Collections": "4.0.10-beta-*",
4+
"System.Console": "4.0.0-beta-*",
5+
"System.Diagnostics.Contracts": "4.0.0-beta-*",
6+
"System.Diagnostics.Debug": "4.0.10-beta-*",
7+
"System.Globalization": "4.0.10-beta-*",
8+
"System.IO": "4.0.10-beta-*",
9+
"System.IO.FileSystem.Primitives": "4.0.0-beta-*",
10+
"System.IO.Pipes": "4.0.0-beta-*",
11+
"System.Linq": "4.0.0-beta-*",
12+
"System.Runtime": "4.0.20-beta-*",
13+
"System.Runtime.Extensions": "4.0.10-beta-*",
14+
"System.Runtime.Handles": "4.0.0-beta-*",
15+
"System.Runtime.InteropServices": "4.0.20-beta-*",
16+
"System.Text.Encoding": "4.0.10-beta-*",
17+
"System.Threading.Overlapped": "4.0.0-beta-*",
18+
"System.Threading.Tasks": "4.0.10-beta-*",
19+
"System.Threading.ThreadPool": "4.0.10-beta-*",
20+
"xunit": "2.0.0-beta5-build2785",
21+
"xunit.abstractions.netcore": "1.0.0-prerelease",
22+
"xunit.assert": "2.0.0-beta5-build2785",
23+
"xunit.core.netcore": "1.0.1-prerelease",
24+
"xunit.netcore.extensions": "1.0.0-prerelease-*"
25+
},
26+
"frameworks": {
27+
"dnxcore50": {}
28+
}
29+
}

0 commit comments

Comments
 (0)