public ApiResult <string> LoadSource(GetSourceRequest request) { var cmd = new LoadSource(scriptProvider, request); cmd.Execute(); return(cmd.Result); }
public void LoadSource_FindsScript() { reqDto = new GetSourceRequest { Script = toMatch, SourceFileName = "script.js" }; cmd = new LoadSource(scriptProvider, reqDto); cmd.Execute(); var result = cmd.Result; Assert.IsNotNull(result); Assert.IsNotNull(result.Content); Assert.IsTrue(result.Success); Assert.AreEqual(toMatch.SourceFiles.First().Contents, result.Content); scriptProviderMock.Verify(s => s.Scripts, Times.Once); }
public void LoadSource_DoesNotFindScriptSource() { reqDto = new GetSourceRequest { Script = toMatch, SourceFileName = "nonexisting.js" }; cmd = new LoadSource(scriptProvider, reqDto); cmd.Execute(); var result = cmd.Result; Assert.IsNotNull(result); Assert.IsNotNull(result.Content); Assert.IsFalse(result.Success); Assert.AreEqual("empty", result.Content); scriptProviderMock.Verify(s => s.Scripts, Times.Once); }
public ApiResult<string> LoadSource(GetSourceRequest request) { var cmd = new LoadSource(scriptProvider, request); cmd.Execute(); return cmd.Result; }