public void LoaderCachesScriptsAfterFirstLoad(string scriptName, string scriptSource, [Frozen] IScriptLoader underlying, CachingScriptLoader sut) { Mock.Get(underlying).Setup(x => x.Load(scriptName)).Returns(scriptSource); sut.Load(scriptName); var actual = sut.Load(scriptName); Assert.Equal(scriptSource, actual); Mock.Get(underlying).Verify(x => x.Load(scriptName), Times.Once()); }
public void LoaderUsesUnderlyingToLoadScripts(string scriptName, string scriptSource, [Frozen] IScriptLoader underlying, CachingScriptLoader sut) { Mock.Get(underlying).Setup(x => x.Load(scriptName)).Returns(scriptSource); var actual = sut.Load(scriptName); Assert.Equal(scriptSource, actual); }
public void CacheIsSharedAcrossLoaders(string scriptName, string scriptSource, [Frozen] IScriptLoader underlying, CachingScriptLoader first, CachingScriptLoader second) { Mock.Get(underlying).Setup(x => x.Load(scriptName)).Returns(scriptSource); first.Load(scriptName); var actual = second.Load(scriptName); Assert.Equal(scriptSource, actual); Mock.Get(underlying).Verify(x => x.Load(scriptName), Times.Once()); }