Exemplo n.º 1
0
 public async Task <bool> Valid(string filename, string checkSum)
 {
     try
     {
         return(await _origin.Valid(filename, checkSum));
     }
     catch (Exception e) when(e.IsFileAccessException())
     {
         throw new AppUpdateException("Failed to validate downloaded file", e);
     }
 }
        public async Task <bool> Valid(string filename, string checkSum)
        {
            if (CacheContains(filename, checkSum) && !FileChanged(filename))
            {
                return(true);
            }

            ClearCache();

            var valid = await _origin.Valid(filename, checkSum);

            if (valid)
            {
                AddToCache(filename, checkSum);
            }

            return(valid);
        }
        public async Task Valid_ShouldBe_Origin_Valid(bool value)
        {
            const string filename = "TestData\\ProtonVPN_win_v1.5.2.exe";

            _origin.Valid("", "").ReturnsForAnyArgs(Task.FromResult(value));

            var result = await _validatable.Valid(filename, "checkSum");

            result.Should().Be(value);
        }
        public async Task Valid_ShouldCall_Origin_Valid_WithArguments()
        {
            const string filename = "TestData\\ProtonVPN_win_v1.0.0.exe";
            const string checkSum = "The expected check sum";

            await _validatable.Valid(filename, checkSum);

            await _origin.Received(1).Valid(filename, checkSum);
        }
Exemplo n.º 5
0
 internal async Task <bool> Valid(Release release)
 {
     return(await _validatable.Valid(FilePath(release), release.File.Sha1CheckSum));
 }