Exemple #1
0
        public async Task LoadAsyncLoadsWhenGivenALoader()
        {
            var loader = A.Fake<IROMLoader>();

            ROM rom = new ROM(loader);

            await rom.LoadAsync();

            A.CallTo(() => loader.LoadROMAsync()).MustHaveHappened();
        }
Exemple #2
0
        public async Task<ValidationResults> ValidateChecksum(string filePath)
        {
            ValidationResults results = new ValidationResults() { ROMFilePath = filePath };

            // Load ROM content
            ROM rom = new ROM(new BinROMLoader(filePath, new BinROMValidator()));
            await rom.LoadAsync();

            // Get the checksum from the ROM. Also run a checksum calculation and compare the results. If not the same,
            // update the ROM and save it
            results.ActualChecksum = rom.Checksum;
            results.CalculatedChecksum = rom.CalculateChecksum();
            results.HasChanged = results.ActualChecksum != results.CalculatedChecksum;

            if (results.ActualChecksum != results.CalculatedChecksum)
            {
                rom.Checksum = results.CalculatedChecksum;
                await rom.SaveAsync();
            }

            return results;
        }