public void ResultSerializationTests() { CalculationResult res1 = new CalculationResult(ar1, row, time1, id1); CalculationResult res2 = CalculationResult.GetFromBytes(CalculationResult.ToBytes(res1)); Assert.AreEqual(res1, res2); }
public void Run() { bool theEnd = false; Console.WriteLine("Receiver running..."); consumer.Received += (model, ea) => { var body = ea.Body; CalculationResult result = CalculationResult.GetFromBytes(ea.Body); var props = ea.BasicProperties; var id = props.CorrelationId; if (result.Row % 32 == 0) { Console.WriteLine(string.Format("Received result, adding to assembly. Row: {0}", result.Row)); } logger.LogWorkerTime(result); if (assembler.AddResult(result)) { channel.BasicPublish(exchange: "", routingKey: Queues.NotificationQueue, body: new byte[] { 1 }); theEnd = assembler.FinalAssembly; } channel.BasicAck(deliveryTag: ea.DeliveryTag, multiple: false); }; while (!theEnd) { } channel.BasicPublish(exchange: "", routingKey: Queues.NotificationQueue, body: new byte[] { 1 }); }