public void CreatesSameFingerprintForSameState() { var dep = new SourceSetDependencies(fingerprintFactory, sourceSet); var fp1 = dep.CreateFingerprint(); var fp2 = dep.CreateFingerprint(); fp1.Should().Be(fp2); fp2.Should().Be(fp1); }
public void RemovingFileChangesFingerprint() { var dep = new SourceSetDependencies(fingerprintFactory, sourceSet); var fp1 = dep.CreateFingerprint(); File.Delete(Path.Combine(tmp, "file1")); sourceSet.Remove(new SuiteRelativePath("file1")); var fp2 = dep.CreateFingerprint(); fp1.Should().NotBe(fp2); }
public void AddingFileChangesFingerprint() { var dep = new SourceSetDependencies(fingerprintFactory, sourceSet); var fp1 = dep.CreateFingerprint(); using (var writer = rootDir.CreateTextFile("file3")) writer.WriteLine("Contents of file 3"); sourceSet.Add(new SuiteRelativePath("file3")); var fp2 = dep.CreateFingerprint(); fp1.Should().NotBe(fp2); }
public void AddingFileToSubdirectoryChangesFingerprint() { var dep = new SourceSetDependencies(fingerprintFactory, sourceSet); var fp1 = dep.CreateFingerprint(); Directory.CreateDirectory(Path.Combine(tmp, "subdir")); using (var writer = rootDir.GetChildDirectory("subdir").CreateTextFile("file3")) writer.WriteLine("Contents of file 3"); sourceSet.Add(new SuiteRelativePath("subdir\\file3")); var fp2 = dep.CreateFingerprint(); fp1.Should().NotBe(fp2); }
public void ModifyingFileChangesFingerprint() { var dep = new SourceSetDependencies(fingerprintFactory, sourceSet); var fp1 = dep.CreateFingerprint(); using (var writer = File.CreateText(Path.Combine(tmp, "file2"))) { writer.WriteLine("Modified contents"); writer.Flush(); } var fp2 = dep.CreateFingerprint(); fp1.Should().NotBe(fp2); }
public void ConvertToProtocolAndBack() { var dep = new SourceSetDependencies(fingerprintFactory, sourceSet); var fp1 = dep.CreateFingerprint(); var proto = fp1.Protocol; var fp2 = proto.CreateFingerprint(); fp1.Should().Be(fp2); }
public void SerializeAndReadBack() { var ser = new BinarySerializer(); var dep = new SourceSetDependencies(fingerprintFactory, sourceSet); var fp1 = dep.CreateFingerprint(); byte[] data; using (var ms = new MemoryStream()) { fp1.Save(ser, ms); data = ms.ToArray(); } SourceSetFingerprint fp2; using (var ms = new MemoryStream(data)) { fp2 = new SourceSetFingerprint(ser, ms); } fp1.Should().Be(fp2); }