private void ConvertThroughProto(ArchivedEvent source) { Com.Daml.Ledger.Api.V1.ArchivedEvent protoValue = source.ToProto(); ArchivedEvent target = ArchivedEvent.FromProto(protoValue); Assert.True(source == target); }
public void EqualityIgnoresWitnessPartyOrder() { var event2 = new ArchivedEvent(PartiesFactory.Witnesses1.Reverse(), "event1", IdentifierFactory.Id1, "contract1"); Assert.True(_event1.Equals(event2)); Assert.True(_event1 == event2); }
private void ArchiveEvent(Event @event, bool finished, string conclusion) { var archivedEvent = new ArchivedEvent() { Id = @event.Id, Added = @event.Added, Updated = @event.Updated, Title = @event.Title, Description = @event.Description, EventSeverity = @event.EventSeverity, Shorthand = @event.Shorthand, SourceId = @event.Source.Id, StateId = @event.State.Id, CheckTypeId = @event.CheckType.Id }; if (!conclusion.Equals("")) { archivedEvent.Conclusion = conclusion; } if (finished) { archivedEvent.Finished = DateTime.Now; archivedEvent.Removed = DateTime.MinValue; } else { archivedEvent.Removed = DateTime.Now; archivedEvent.Finished = DateTime.MinValue; } _archive.CheckCenterFinishedEvents.Add(archivedEvent); _archive.SaveChanges(); }
private void ConvertThroughProtoUsingEventHelper(ArchivedEvent source) { Com.Daml.Ledger.Api.V1.Event protoValue = EventHelper.ToProtoEvent(source); var target = EventHelper.FromProtoEvent(protoValue); target.Should().BeOfType <ArchivedEvent>(); Assert.True(source == (ArchivedEvent)target); }
private void ConvertThroughProtoUsingEventHelper(ArchivedEvent source) { Com.DigitalAsset.Ledger.Api.V1.Event protoValue = EventHelper.ToProtoEvent(source); var target = EventHelper.FromProtoEvent(protoValue); Assert.IsTrue(target is ArchivedEvent); Assert.IsTrue(source == (ArchivedEvent)target); }
private ReturnableEvent ConvertEvent(ArchivedEvent archivedEvent, bool allData = false) { var @event = new ReturnableEvent() { Id = archivedEvent.Id, Added = archivedEvent.Added, Updated = archivedEvent.Updated, Title = archivedEvent.Title, Description = archivedEvent.Description, Conclusion = archivedEvent.Conclusion, EventSeverity = archivedEvent.EventSeverity, Shorthand = archivedEvent.Shorthand, Finished = archivedEvent.Finished == DateTime.MinValue ? null : archivedEvent.Finished.ToString(CultureInfo.CurrentCulture), Removed = archivedEvent.Removed == DateTime.MinValue ? null : archivedEvent.Removed.ToString(CultureInfo.CurrentCulture), }; if (!allData) { return(@event); } var comments = _archive.CheckCenterComments .Where(c => c.EventId == @event.Id) .ToList(); @event.Comments = comments; var feedback = _archive.CheckCenterFeedback .Where(c => c.EventId == @event.Id) .ToList(); @event.Feedback = feedback; var actionLogs = _archive.CheckCenterActionLogs .Where(c => c.EventId == @event.Id) .ToList(); @event.ActionLogs = actionLogs; var info = _archive.CheckCenterAdditionalInfo .Where(c => c.EventId == @event.Id) .ToList(); @event.AdditionalInfo = info; @event.Source = Context.CheckCenterSources.First(s => s.Id == archivedEvent.SourceId); @event.State = Context.CheckCenterStates.First(s => s.Id == archivedEvent.StateId); @event.CheckType = Context.CheckCenterCheckTypes.First(t => t.Id == archivedEvent.CheckTypeId); return(@event); }