diff options
author | Kirill Osenkov <KirillOsenkov@users.noreply.github.com> | 2018-04-10 18:40:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-10 18:40:25 +0300 |
commit | 000c075e6ee11666f81096b83de962c18cac320f (patch) | |
tree | 25d394cac2c4bc6f84183969961bd6aedc98ff2b /Test | |
parent | d9291426df01bd1c3b4e63c04b5bac735d172518 (diff) | |
parent | cb6923f5b2a344adbabb0a497abfde9f97e1a66b (diff) |
Merge pull request #108 from KirillOsenkov/Fix105
Fix https://github.com/mono/mono-addins/issues/105
Diffstat (limited to 'Test')
-rw-r--r-- | Test/UnitTests/TestFileDatabase.cs | 41 | ||||
-rw-r--r-- | Test/UnitTests/UnitTests.csproj | 4 |
2 files changed, 45 insertions, 0 deletions
diff --git a/Test/UnitTests/TestFileDatabase.cs b/Test/UnitTests/TestFileDatabase.cs new file mode 100644 index 0000000..f650fce --- /dev/null +++ b/Test/UnitTests/TestFileDatabase.cs @@ -0,0 +1,41 @@ +using System.IO; +using Mono.Addins.Database; +using NUnit.Framework; + +namespace UnitTests +{ + [TestFixture] + public class TestFileDatabase : TestBase + { + // https://github.com/mono/mono-addins/issues/105 + [Test] + public void TestFilePathCaseOnWindows() + { + if (!Mono.Addins.Database.Util.IsWindows) { + return; + } + + var rootPath = Path.Combine(TempDir, nameof(TestFilePathCaseOnWindows)); + Directory.CreateDirectory(rootPath); + + var fileDatabase = new FileDatabase(rootPath); + try { + var folder = Path.Combine(rootPath, "Folder"); + Directory.CreateDirectory(folder); + + folder = char.ToUpperInvariant(folder[0]) + folder.Substring(1); + var addinScanFolderInfo = new AddinScanFolderInfo(folder); + addinScanFolderInfo.Write(fileDatabase, folder); + + folder = char.ToLowerInvariant(folder[0]) + folder.Substring(1); + var actual = AddinScanFolderInfo.Read(fileDatabase, folder, folder); + + Assert.NotNull(actual); + Assert.AreEqual(1, Directory.GetFiles(folder).Length); + } + finally { + Directory.Delete(rootPath, recursive: true); + } + } + } +} diff --git a/Test/UnitTests/UnitTests.csproj b/Test/UnitTests/UnitTests.csproj index 9c0bb51..adf04b9 100644 --- a/Test/UnitTests/UnitTests.csproj +++ b/Test/UnitTests/UnitTests.csproj @@ -10,6 +10,8 @@ <SchemaVersion>2.0</SchemaVersion> <RootNamespace>UnitTests</RootNamespace> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + <SignAssembly>True</SignAssembly> + <AssemblyOriginatorKeyFile>..\..\mono-addins.snk</AssemblyOriginatorKeyFile> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>True</DebugSymbols> @@ -30,6 +32,7 @@ <PackageReference Include="NUnit3TestAdapter"> <Version>3.10.0</Version> </PackageReference> + <PackageReference Include="Mono.Cecil" Version="0.10.0" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\Mono.Addins\Mono.Addins.csproj"> @@ -49,6 +52,7 @@ <Compile Include="TestExtensions.cs" /> <Compile Include="TestBase.cs" /> <Compile Include="TestEvents.cs" /> + <Compile Include="TestFileDatabase.cs" /> <Compile Include="TestLoadUnload.cs" /> <Compile Include="TestConditions.cs" /> <Compile Include="TestSetup.cs" /> |