Ejemplo n.º 1
0
        public async Task CanUpdateLocalFileIgnoringTheResult()
        {
            using var executionContext = new WebFileSourceTestExecutionContext();
            var result = await CanUpdateLocalFileAcceptingOrIgnoringResultAsync(executionContext, true);

            Assert.IsFalse(result.FileExistedUpfront);
            Assert.IsFalse(result.UpToDate);
        }
Ejemplo n.º 2
0
        public async Task CannotUpdateLocalFileIfUrlIsInValid()
        {
            using var executionContext = new WebFileSourceTestExecutionContext();
            Assert.IsFalse(File.Exists(executionContext.LocalFileName));
            var upToDate = await executionContext.WebFileSource.TryAndUpdateLocalCopyOfWebFileReturnUpToDateAsync(WrongReadMeUrl, executionContext.LocalFileName);

            Assert.IsFalse(upToDate);
        }
Ejemplo n.º 3
0
        private async Task <UpdateResult> CanUpdateLocalFileAcceptingOrIgnoringResultAsync(WebFileSourceTestExecutionContext context, bool ignoreResult)
        {
            var result = new UpdateResult {
                FileExistedUpfront = File.Exists(context.LocalFileName),
                UpToDate           = false
            };

            if (ignoreResult)
            {
                await context.WebFileSource.TryAndUpdateLocalCopyOfWebFileAsync(ReadMeUrl, context.LocalFileName);
            }
            else
            {
                result.UpToDate = await context.WebFileSource.TryAndUpdateLocalCopyOfWebFileReturnUpToDateAsync(ReadMeUrl, context.LocalFileName);
            }

            return(result);
        }