-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #422 from NetOfficeFw/dev/406_refactor_to_assembly…
…_location
- Loading branch information
Showing
16 changed files
with
296 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
Source/NetOffice.Tests/NetOffice/Diagnostics/SelfDiagnosticsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using NetOffice.Diagnostics; | ||
using NUnit.Framework; | ||
|
||
namespace NetOffice.Tests.NetOffice | ||
{ | ||
[TestFixture] | ||
public class SelfDiagnosticsTests | ||
{ | ||
[Test] | ||
public void AssemblyTitle_AssemblyWithNoAttribute_ReturnTitleBasedOnFilename() | ||
{ | ||
// Arrange | ||
var addin = new NoAssemblyTitleAddin(); | ||
var diag = new SelfDiagnostics(addin); | ||
|
||
// Act | ||
var title = diag.AssemblyTitle; | ||
|
||
// Assert | ||
Assert.AreEqual("NoAssemblyTitle", title); | ||
} | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
Source/NetOffice.Tests/NetOffice/Loader/PathBuilderTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using NetOffice.Loader; | ||
using NUnit.Framework; | ||
|
||
namespace NetOffice.Tests.NetOffice.Loader | ||
{ | ||
[TestFixture] | ||
public class PathBuilderTests | ||
{ | ||
[Test] | ||
public void BuildLocalPathFromDependentAssembly_SampleDependentAssembly_ResolvesPathToAssemblyFile() | ||
{ | ||
// Arrange | ||
var expectedAssemblyName = "NetOffice.Core.dll"; | ||
var assembly = new DependentAssembly(expectedAssemblyName, typeof(Core).Assembly); | ||
|
||
// Act | ||
var path = PathBuilder.BuildLocalPathFromDependentAssembly(assembly); | ||
|
||
// Assert | ||
StringAssert.EndsWith(expectedAssemblyName, path); | ||
Assert.IsTrue(Path.IsPathRooted(path)); | ||
} | ||
|
||
[Test] | ||
[TestCaseSource(nameof(NetOfficeAssemblyNameTestCase))] | ||
public void BuildLocalPathFromAssemblyFileName_NetOfficeAssemblyName_ResolvesPathToAssemblyFile(string assemblyName) | ||
{ | ||
// Arrange | ||
var factory = new Core(); | ||
|
||
// Act | ||
var path = PathBuilder.BuildLocalPathFromAssemblyFileName(factory, assemblyName); | ||
|
||
// Assert | ||
StringAssert.EndsWith(assemblyName, path); | ||
Assert.IsTrue(Path.IsPathRooted(path)); | ||
} | ||
|
||
public static IEnumerable<string> NetOfficeAssemblyNameTestCase | ||
{ | ||
get | ||
{ | ||
return Core.Default.CoreDomain.AssemblyNames; | ||
} | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
Source/NetOffice.Tests/OfficeApi/Tools/AssemblyInfoTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using NetOffice.Diagnostics; | ||
using NetOffice.OfficeApi.Tools.Informations; | ||
using NUnit.Framework; | ||
|
||
namespace NetOffice.Tests.NetOffice | ||
{ | ||
[TestFixture] | ||
public class AssemblyInfoTests | ||
{ | ||
[Test] | ||
public void AssemblyTitle_AssemblyWithNoAttribute_ReturnTitleBasedOnFilename() | ||
{ | ||
// Arrange | ||
var addin = new NoAssemblyTitleAddin(); | ||
var ownerAssembly = addin.GetType().Assembly; | ||
var diag = new AssemblyInfo(ownerAssembly); | ||
|
||
// Act | ||
var title = diag.AssemblyTitle; | ||
|
||
// Assert | ||
Assert.AreEqual("NoAssemblyTitle", title); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net462</TargetFrameworks> | ||
<LangVersion>8</LangVersion> | ||
<Nullable>enable</Nullable> | ||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> | ||
<SignAssembly>True</SignAssembly> | ||
<AssemblyOriginatorKeyFile>..\..\Source\NetOffice.snk</AssemblyOriginatorKeyFile> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Source\NetOffice\NetOffice.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.