Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 public ApiResult<string> LoadSource(GetSourceRequest request)
 {
     var cmd = new LoadSource(scriptProvider, request);
     cmd.Execute();
     return cmd.Result;
 }