public void UpdateSnapshot() { var snapshotId = _snapshotResolver.ResolveSnapshotSetup(); var writer = new SnapshotWriter(); // record the current snapshot var data = "this is\r\na\r\ntest"; var token = SnapshotTokenizer.Tokenize(data); writer.Write(token, snapshotId); // ensure the data matches data.MatchSnapshot(); data = "this is\r\nnew\r\ndata"; token = SnapshotTokenizer.Tokenize(data); writer.Write(token, snapshotId); // ensure the data is updated data.MatchSnapshot(); //delete file and folder System.IO.File.Delete(snapshotId.GetFilePath()); }
public void SaveSnapshots() { var snapshotId = _snapshotResolver.ResolveSnapshotSetup(); var writer = new SnapshotWriter(); // record the current snapshot var dataOne = "this is\r\na\r\ntest"; var token = SnapshotTokenizer.Tokenize(dataOne) .SetMetadata(() => new { id = "one" }); writer.Write(token, snapshotId); var dataTwo = "this is\r\na second\r\ntest"; token = SnapshotTokenizer.Tokenize(dataTwo) .SetMetadata(() => new { id = "two" }); writer.Write(token, snapshotId); // ensure there are 2 snapshots in the file var reader = new SnapshotReader(); var saved = reader.Read(snapshotId); saved.Count().Should().Be(2); // match the snapshots dataOne.MatchSnapshot(() => new { id = "one" }); dataTwo.MatchSnapshot(() => new { id = "two" }); //delete file and folder System.IO.File.Delete(snapshotId.GetFilePath()); }
public void SaveSnapshot() { var data = "this is\r\na\r\ntest"; var snapshotId = _snapshotResolver.ResolveSnapshotSetup(); var token = SnapshotTokenizer.Tokenize(data); var writer = new SnapshotWriter(); writer.Write(token, snapshotId); //reload snapshot to compare data.MatchSnapshot(); //delete file and folder System.IO.File.Delete(snapshotId.GetFilePath()); }