public void VerifyCustomerRelationshipServiceCreateResponse() { WaitForKafkaResponseAfterCreate(); Assert.AreEqual(CreateCustomerRelationshipModel.ParentCustomerUID, createCustomerRelationshipResponse.CreateCustomerRelationshipEvent.ParentCustomerUID); Assert.AreEqual(CreateCustomerRelationshipModel.ChildCustomerUID, createCustomerRelationshipResponse.CreateCustomerRelationshipEvent.ChildCustomerUID); Assert.AreEqual(CreateCustomerRelationshipModel.ActionUTC.ToString("yyyyMMddHHmmss"), createCustomerRelationshipResponse.CreateCustomerRelationshipEvent.ActionUTC.ToString("yyyyMMddHHmmss")); createCustomerRelationshipResponse = null; // Reassigning the response back to null }
public void Handle(PayloadMessage message) { try { if (message.Value == null || message.Value == "null") { LogResult.Report(Log, "log_ForInfo", "Kafka Message is Null"); return; } if (CreateCustomerRelationshipModel != null && CreateCustomerRelationshipModel.ActionUTC != null) { if (CreateCustomerRelationshipModel.ActionUTC.ToString() != null && message.Value.Contains(CreateCustomerRelationshipModel.ActionUTC.ToString("yyyy-MM-ddTHH:mm:ss")) && message.Value.Contains(CreateCustomerRelationshipModel.ReceivedUTC.ToString()) && CreateCustomerRelationshipModel.ParentCustomerUID.ToString() != null && message.Value.Contains(CreateCustomerRelationshipModel.ParentCustomerUID.ToString()) && CreateCustomerRelationshipModel.ChildCustomerUID.ToString() != null && message.Value.Contains(CreateCustomerRelationshipModel.ChildCustomerUID.ToString())) { createCustomerRelationshipResponse = JsonConvert.DeserializeObject <CreateCustomerRelationshipModel>(message.Value); } LogResult.Report(Log, "log_ForInfo", string.Format("Response Received With Offset {0}: {1}", message.OffSet, message.Value)); if (DeleteCustomerRelationshipModel != null && DeleteCustomerRelationshipModel.ActionUTC != null && DeleteCustomerRelationshipModel.ParentCustomerUID != Guid.Empty) { if (DeleteCustomerRelationshipModel.ActionUTC.ToString() != null && message.Value.Contains(DeleteCustomerRelationshipModel.ActionUTC.ToString("yyyy-MM-ddTHH:mm:ss")) && message.Value.Contains(DeleteCustomerRelationshipModel.ReceivedUTC.ToString()) && DeleteCustomerRelationshipModel.ParentCustomerUID.ToString() != null && message.Value.Contains(DeleteCustomerRelationshipModel.ParentCustomerUID.ToString()) && DeleteCustomerRelationshipModel.ParentCustomerUID.ToString() != null && message.Value.Contains(DeleteCustomerRelationshipModel.ParentCustomerUID.ToString())) { deleteCustomerRelationshipResponse = JsonConvert.DeserializeObject <DeleteCustomerRelationshipModel>(message.Value); } LogResult.Report(Log, "log_ForInfo", string.Format("Response Received With Offset {0}: {1}", message.OffSet, message.Value)); } } } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Got Error While Handling Response", e); throw new Exception(e + "Got Error While Handling Response"); } }