public void Should_report_that_file_is_broken_if_last_synchronization_set_exception() { var destinationClient = NewClient(0); var sampleGuid = Guid.NewGuid(); var failureSynchronization = new SynchronizationReport("test.bin", sampleGuid, SynchronizationType.Unknown) {Exception = new Exception("There was an exception in last synchronization.")}; //var sb = new StringBuilder(); //var jw = new JsonTextWriter(new StringWriter(sb)); //new JsonSerializer().Serialize(jw, failureSynchronization); //destinationClient.Config.SetConfig(RavenFileNameHelper.SyncResultNameForFile("test.bin"), // new NameValueCollection() {{"value", sb.ToString()}}).Wait(); destinationClient.Config.SetConfig(RavenFileNameHelper.SyncResultNameForFile("test.bin"), failureSynchronization.AsConfig()).Wait(); var confirmations = destinationClient.Synchronization.ConfirmFilesAsync(new List<Tuple<string, Guid>> { new Tuple<string, Guid>( "test.bin", sampleGuid) }).Result.ToList(); Assert.Equal(1, confirmations.Count()); Assert.Equal(FileStatus.Broken, confirmations.ToArray()[0].Status); Assert.Equal("test.bin", confirmations.ToArray()[0].FileName); }
private void SaveSynchronizationReport(string fileName, StorageActionsAccessor accessor, SynchronizationReport report) { var name = RavenFileNameHelper.SyncResultNameForFile(fileName); accessor.SetConfig(name, report.AsConfig()); }