コード例 #1
0
 public void ReturnsReaderResults(
     FilePath existing,
     MutagenPatchersListing listing,
     CancellationToken cancel,
     RegistryListingsProvider sut)
 {
     sut.FilePathProvider.Path.Returns(existing);
     sut.ListingReader.Read(default).ReturnsForAnyArgs(listing);
コード例 #2
0
        public void Write(MutagenPatchersListing listings)
        {
            _fileSystem.File.WriteAllText(_pathProvider.Path,
                                          JsonSerializer.Serialize(
                                              listings,
                                              _jsonOptions.Options));

            Console.WriteLine($"{_pathProvider.Path} {(_fileSystem.File.Exists(_pathProvider.Path) ? "exists." : "does not exist!")}");
        }
コード例 #3
0
        public async Task <MutagenPatchersListing> Clean(MutagenPatchersListing existingListings)
        {
            var listed = await _listingsProvider.Get();

            var listedSet = listed
                            .Select(x => new ListingKey(x.User, x.Repository))
                            .ToHashSet();

            return(new MutagenPatchersListing()
            {
                Repositories = existingListings.Repositories
                               .Where(x => listedSet.Contains(new ListingKey(x.User, x.Repository)))
                               .ToArray()
            });
        }