Add test case for LockFilePatcher under design time

This commit is contained in:
Troy Dai 2016-03-31 14:06:04 -07:00
parent e176c1d3b9
commit 32ed90afb2

View file

@ -77,6 +77,15 @@ namespace Microsoft.DotNet.ProjectModel.Tests
Assert.Throws<FileFormatException>(() => LockFileReader.Read(lockFilePath, designTime: false));
}
[Fact]
public void TestMissingExportUnderDesignTime()
{
var lockFilePath = GetLockFilePath("invalid_nofragment");
// not throw under design time scenario
Assert.NotNull(LockFileReader.Read(lockFilePath, designTime: true));
}
[Fact]
public void TestMissingExportsThrow()
@ -86,6 +95,15 @@ namespace Microsoft.DotNet.ProjectModel.Tests
Assert.Throws<FileFormatException>(() => LockFileReader.Read(lockFilePath, designTime: false));
}
[Fact]
public void TestMissingExportsUnderDesignTime()
{
var lockFilePath = GetLockFilePath("invalid_missing-exports");
// not throw under design time scenario
Assert.NotNull(LockFileReader.Read(lockFilePath, designTime: true));
}
[Fact]
public void TestMissmatchingFileVersionsThrows()
{
@ -94,6 +112,14 @@ namespace Microsoft.DotNet.ProjectModel.Tests
Assert.Throws<FileFormatException>(() => LockFileReader.Read(lockFilePath, designTime: false));
}
[Fact]
public void TestMissmatchingFileVersionsUnderDesignTime()
{
var lockFilePath = GetLockFilePath("invalid_missmatching-versions");
Assert.NotNull(LockFileReader.Read(lockFilePath, designTime: true));
}
private static int LibraryNumberFromName(Microsoft.DotNet.ProjectModel.Graph.LockFileTargetLibrary library)
{
var libraryName = library.Name;