Skip to content

Commit

Permalink
Fix openLoader functions in unit tests so that they do not add elemen…
Browse files Browse the repository at this point in the history
…t to a cache.
  • Loading branch information
AR-May committed Jul 15, 2021
1 parent cd7f180 commit 38121b5
Showing 1 changed file with 0 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public void Get_GivenOpenFuncWhichAddsRootElement_ReturnsRootElement()
ProjectRootElement rootElementToCache = ProjectRootElement.Create(projectFileToCache);
ProjectRootElement OpenFunc(string pathArg, ProjectRootElementCacheBase cacheArg)
{
cacheArg.AddEntry(rootElementToCache);
return rootElementToCache;
}

Expand All @@ -79,7 +78,6 @@ public void Get_GivenOpenFuncWhichAddsRootElementWithDifferentCasing_ReturnsRoot
ProjectRootElement rootElementToCache = ProjectRootElement.Create(projectFileToCache);
ProjectRootElement OpenFunc(string pathArg, ProjectRootElementCacheBase cacheArg)
{
cacheArg.AddEntry(rootElementToCache);
return rootElementToCache;
}

Expand Down Expand Up @@ -112,7 +110,6 @@ public void Get_GivenOpenFuncWhichReturnsIncorrectProject_ThrowsInternalErrorExc
ProjectRootElement rootElementToCache = ProjectRootElement.Create(projectFileToCache);
ProjectRootElement OpenFunc(string pathArg, ProjectRootElementCacheBase cacheArg)
{
cacheArg.AddEntry(rootElementToCache);
return rootElementToCache;
}

Expand All @@ -123,21 +120,5 @@ ProjectRootElement OpenFunc(string pathArg, ProjectRootElementCacheBase cacheArg
cache.Get(projectFile, OpenFunc, false, null);
});
}

[Fact]
public void Get_GivenOpenFuncWhichDoesNotAddToCache_ThrowsInternalErrorException()
{
string projectFile = NativeMethodsShared.IsUnixLike ? "/foo" : "c:\\foo";
string openFuncPath = NativeMethodsShared.IsUnixLike ? "/foo" : "c:\\foo";
ProjectRootElement openFuncElement = ProjectRootElement.Create(openFuncPath);
ProjectRootElement OpenFunc(string pathArg, ProjectRootElementCacheBase cacheArg) => openFuncElement;

var cache = new SimpleProjectRootElementCache();

Should.Throw<InternalErrorException>(() =>
{
cache.Get(projectFile, OpenFunc, false, null);
});
}
}
}

0 comments on commit 38121b5

Please sign in to comment.