/// <summary> /// Initializes a new instance of the <see cref="FileHashCalculator"/> class. /// </summary> /// <param name="fileSystem">The file system.</param> /// <param name="hashAlgorithmBuilder">The hash algorithm builder.</param> public FileHashCalculator(IFileSystem fileSystem, IHashAlgorithmBuilder hashAlgorithmBuilder) { if (fileSystem == null) { throw new ArgumentNullException(nameof(fileSystem)); } if (hashAlgorithmBuilder == null) { throw new ArgumentNullException(nameof(hashAlgorithmBuilder)); } _fileSystem = fileSystem; _hashAlgorithmBuilder = hashAlgorithmBuilder; }
/// <summary> /// Initializes a new instance of the <see cref="DirectoryHashCalculator"/> class. /// </summary> /// <param name="context">The cake context.</param> /// <param name="hashAlgorithmBuilder">The hash algorithm builder.</param> public DirectoryHashCalculator(ICakeContext context, IHashAlgorithmBuilder hashAlgorithmBuilder) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (hashAlgorithmBuilder == null) { throw new ArgumentNullException(nameof(hashAlgorithmBuilder)); } _context = context; _hashAlgorithmBuilder = hashAlgorithmBuilder; _fileHashCalculator = new FileHashCalculator(_context.FileSystem, _hashAlgorithmBuilder); }