private bool TestPropertyValue(RouteNetworkEvent routeNetworkEvent, object expected, object actual, string propertyName) { if (expected == null && actual == null) { return(true); } if ((expected != null && actual == null) || (expected == null && actual != null)) { Log.Error($"The property: {propertyName} in event at seq no: {routeNetworkEvent.EventSequenceNumber} has an unexpeted property value: '{actual}' Expected: '{expected}'"); return(false); } if (expected is DateTime) { if (!expected.ToString().Equals(actual.ToString())) { Log.Error($"The property: {propertyName} in event at seq no: {routeNetworkEvent.EventSequenceNumber} has an unexpeted property value: '{actual}' Expected: '{expected}'"); return(false); } } else { if (!expected.Equals(actual)) { Log.Error($"The property: {propertyName} in event at seq no: {routeNetworkEvent.EventSequenceNumber} has an unexpeted property value: '{actual}' Expected: '{expected}'"); return(false); } } return(true); }
protected bool CheckEventTimestamp(RouteNetworkEvent routeNetworkEvent, DateTime startTime) { if (routeNetworkEvent.EventTimestamp == null || routeNetworkEvent.EventTimestamp < startTime) { return(Fail($"Expected an EventTimestamp that was newer than scenario start time: {startTime} on the event with id: {routeNetworkEvent.EventId} but got: {routeNetworkEvent.EventTimestamp}")); } else { return(true); } }
protected bool CheckApplicationName(RouteNetworkEvent routeNetworkEvent, string expectedApplicationName) { if (routeNetworkEvent.ApplicationName == null || routeNetworkEvent.ApplicationName != expectedApplicationName) { return(Fail($"Expected ApplicationName: '{expectedApplicationName}' on the event with id: {routeNetworkEvent.EventId} but got: '{routeNetworkEvent.ApplicationName}'")); } else { return(true); } }
protected bool CheckCmdType(RouteNetworkEvent routeNetworkEvent, string expectedCmdType) { if (routeNetworkEvent.CmdType == null || routeNetworkEvent.CmdType != expectedCmdType) { return(Fail($"Expected CmdType: '{expectedCmdType}' on the event with id: {routeNetworkEvent.EventId} but got: '{routeNetworkEvent.CmdType}'")); } else { return(true); } }
protected bool CheckThatUserNameIsTransferedToEvent(RouteNetworkEvent routeNetworkEvent, string expectedUserName) { if (routeNetworkEvent.UserName == null || routeNetworkEvent.UserName != expectedUserName) { return(Fail($"Expected UserName: '******' to be transfered to the event with id: {routeNetworkEvent.EventId} from the original record inserted in postgres.")); } else { return(true); } }
protected bool CheckThatWorkTaskMridIsTransferedToEvent(RouteNetworkEvent routeNetworkEvent, Guid expectedWorkTaskMrid) { if (routeNetworkEvent.WorkTaskMrid == null || routeNetworkEvent.WorkTaskMrid != expectedWorkTaskMrid) { return(Fail($"Expected WorkTaskMrid: {expectedWorkTaskMrid} to be transfered to the event with id: {routeNetworkEvent.EventId} from the original record inserted in postgres.")); } else { return(true); } }
protected bool CheckThatIsLastEventInCmdIsFalse(RouteNetworkEvent routeNetworkEvent) { // Check that IsLastEventInCmd is set to false if (routeNetworkEvent.IsLastEventInCmd != false) { return(Fail($"IsLastEventInCmd was expected to be false on event with id {routeNetworkEvent.EventId}")); } else { return(true); } }
private bool TestIfIdNotAlreadyUsed(RouteNetworkEvent routeNetworkEvent, Guid id, HashSet <Guid> usedIds, string propertyName) { if (usedIds.Contains(id)) { Log.Error($"The property: {propertyName} in event at seq no: {routeNetworkEvent.EventSequenceNumber} contains a non unique id: {id} This is already used elsewere in the event stream."); return(false); } else { usedIds.Add(id); return(true); } }
protected bool CheckEventId(RouteNetworkEvent routeNetworkEvent) { if (routeNetworkEvent.EventId == null || routeNetworkEvent.EventId == Guid.Empty) { return(Fail($"EventId is null or empty on event with id: {routeNetworkEvent.EventId}")); } else { if (_idsUsed.Contains(routeNetworkEvent.EventId)) { return(Fail($"EventId is not unique on event with id: {routeNetworkEvent.EventId}")); } } _idsUsed.Add(routeNetworkEvent.EventId); return(true); }