Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Commit

Permalink
Add unit test cover GacDependencyResolver.GetDescription
Browse files Browse the repository at this point in the history
  • Loading branch information
troydai committed Apr 29, 2015
1 parent 5628d40 commit 48cfe5f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.AspNet.Testing.xunit;
using Microsoft.Framework.Runtime.Helpers;
using NuGet;
using Xunit;

namespace Microsoft.Framework.Runtime.Tests
{
public class GacDependencyResolverFacts
{
[ConditionalTheory]
[FrameworkSkipCondition(RuntimeFrameworks.Mono)]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
[InlineData("mscorlib", "4.0.0.0", "dnx451", true)]
[InlineData("mscorlib", "1.0.0.0", "dnx451", false)]
[InlineData("mscorlib", "4.0.0.0", "dnxcore50", false)]
public void GetDescriptionReturnsCorrectResults(string name, string version, string framework, bool found)
{
var libraryRange = new LibraryRange()
{
Name = name,
VersionRange = VersionUtility.ParseVersionRange(version),
IsGacOrFrameworkReference = true
};

var frameworkName = FrameworkNameHelper.ParseFrameworkName(framework);
var resolver = new GacDependencyResolver();
var library = resolver.GetDescription(libraryRange, frameworkName);

if (found)
{
Assert.NotNull(library);
Assert.Equal(SemanticVersion.Parse(version), library.Identity.Version);
}
else
{
Assert.Null(library);
}
}
}
}
1 change: 1 addition & 0 deletions test/Microsoft.Framework.Runtime.Tests/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"dependencies": {
"Microsoft.Framework.Runtime": "1.0.0-*",
"Microsoft.Framework.Runtime.Interfaces": "1.0.0-*",
"Microsoft.AspNet.Testing": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},
"frameworks": {
Expand Down

0 comments on commit 48cfe5f

Please sign in to comment.