Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
Merge branch 'Development'
Browse files Browse the repository at this point in the history
  • Loading branch information
domysee committed Feb 23, 2018
2 parents 33c4060 + ea8f902 commit 82c9d54
Show file tree
Hide file tree
Showing 8 changed files with 396 additions and 75 deletions.
17 changes: 10 additions & 7 deletions Pather.CSharp.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.9
VisualStudioVersion = 15.0.27130.2036
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{16603959-8D03-4A8D-A93B-A5B8A7D257CE}"
EndProject
Expand All @@ -11,7 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{071C74B6-0
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pather.CSharp", "src\Pather.CSharp\Pather.CSharp.csproj", "{0A0CEA4B-96AE-4913-9FF9-F6DFD2553FE0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pather.CSharp.UnitTests", "test\Pather.CSharp.UnitTests\Pather.CSharp.UnitTests.csproj", "{746C2447-C281-45A6-A8F4-8CBD71167D69}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pather.CSharp.UnitTests", "test\Pather.CSharp.UnitTests\Pather.CSharp.UnitTests.csproj", "{6D5AA87A-2B5D-4192-9DAB-F24A57C5F994}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -23,16 +23,19 @@ Global
{0A0CEA4B-96AE-4913-9FF9-F6DFD2553FE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A0CEA4B-96AE-4913-9FF9-F6DFD2553FE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A0CEA4B-96AE-4913-9FF9-F6DFD2553FE0}.Release|Any CPU.Build.0 = Release|Any CPU
{746C2447-C281-45A6-A8F4-8CBD71167D69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{746C2447-C281-45A6-A8F4-8CBD71167D69}.Debug|Any CPU.Build.0 = Debug|Any CPU
{746C2447-C281-45A6-A8F4-8CBD71167D69}.Release|Any CPU.ActiveCfg = Release|Any CPU
{746C2447-C281-45A6-A8F4-8CBD71167D69}.Release|Any CPU.Build.0 = Release|Any CPU
{6D5AA87A-2B5D-4192-9DAB-F24A57C5F994}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D5AA87A-2B5D-4192-9DAB-F24A57C5F994}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D5AA87A-2B5D-4192-9DAB-F24A57C5F994}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D5AA87A-2B5D-4192-9DAB-F24A57C5F994}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{0A0CEA4B-96AE-4913-9FF9-F6DFD2553FE0} = {16603959-8D03-4A8D-A93B-A5B8A7D257CE}
{746C2447-C281-45A6-A8F4-8CBD71167D69} = {071C74B6-0271-4D58-B49B-33AE63D02F1C}
{6D5AA87A-2B5D-4192-9DAB-F24A57C5F994} = {071C74B6-0271-4D58-B49B-33AE63D02F1C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CD9289F3-8FBA-43CE-BC32-E8EB852AC24B}
EndGlobalSection
EndGlobal
31 changes: 31 additions & 0 deletions src/Pather.CSharp/IResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,38 @@ public interface IResolver
IList<IPathElementFactory> PathElementFactories { get; set; }

IList<IPathElement> CreatePath(string path);
/// <summary>
/// Returns the object defined by the path elements.
/// Any access exception (e.g. NullReference) is propagated.
/// </summary>
/// <param name="target"></param>
/// <param name="pathElements"></param>
/// <returns></returns>
object Resolve(object target, IList<IPathElement> pathElements);

/// <summary>
/// Returns the object defined by the path.
/// Any access exception (e.g. NullReference) is propagated.
/// </summary>
/// <param name="target"></param>
/// <param name="path"></param>
/// <returns></returns>
object Resolve(object target, string path);

/// <summary>
/// Returns null if any object in the path is null
/// </summary>
/// <param name="target"></param>
/// <param name="pathElements"></param>
/// <returns></returns>
object ResolveSafe(object target, IList<IPathElement> pathElements);

/// <summary>
/// Returns null if any object in the path is null
/// </summary>
/// <param name="target"></param>
/// <param name="path"></param>
/// <returns></returns>
object ResolveSafe(object target, string path);
}
}
3 changes: 2 additions & 1 deletion src/Pather.CSharp/Pather.CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
<PackageLicenseUrl>https://github.com/Domysee/Pather.CSharp/blob/master/LICENSE</PackageLicenseUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/Domysee/Pather.CSharp</RepositoryUrl>
<Version>2.0.4</Version>
<Version>2.1.0</Version>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
24 changes: 24 additions & 0 deletions src/Pather.CSharp/Resolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,29 @@ private IPathElement createPathElement(string path, out string newPath)
IPathElement result = pathElementFactory.Create(path, out newPath);
return result;
}

public object ResolveSafe(object target, IList<IPathElement> pathElements)
{
try
{
return Resolve(target, pathElements);
}
catch (NullReferenceException)
{
return null;
}
}

public object ResolveSafe(object target, string path)
{
try
{
return Resolve(target, path);
}
catch (NullReferenceException)
{
return null;
}
}
}
}
28 changes: 9 additions & 19 deletions test/Pather.CSharp.UnitTests/Pather.CSharp.UnitTests.csproj
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<AssemblyName>Pather.CSharp.UnitTests</AssemblyName>
<PackageId>Pather.CSharp.UnitTests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion>
<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
</PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>

<ItemGroup>
<ProjectReference Include="..\..\src\Pather.CSharp\Pather.CSharp.csproj" />
</ItemGroup>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170106-08" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta5-build1225" />
<PackageReference Include="FluentAssertions" Version="4.13.0" />
<PackageReference Include="xunit" Version="2.2.0-beta5-build3474" />
<PackageReference Include="FluentAssertions" Version="5.1.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.2.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.2.0" />
</ItemGroup>

<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
<ProjectReference Include="..\..\src\Pather.CSharp\Pather.CSharp.csproj" />
</ItemGroup>

</Project>
19 changes: 0 additions & 19 deletions test/Pather.CSharp.UnitTests/Properties/AssemblyInfo.cs

This file was deleted.

Loading

0 comments on commit 82c9d54

Please sign in to comment.