public async Task SerializeDeserializeAsync() { // Arrange var testObject = new ZeroTestHelperObject { Name = "RussianTestObject", Address = "1600 Pennsylvania Ave.", BitsAndPieces = new List <string> { "russianoperative", "spraytan", "traitor", "peetape", "kompromat" } }; // Act var data = await SerializeAsZeroFormatAsync(testObject).ConfigureAwait(false); data = await CompressBytesWithLZ4Async(data).ConfigureAwait(false); // Assert Assert.NotNull(data); // Re-Act var testData = await DecompressBytesWithLZ4Async(data).ConfigureAwait(false); // Re-Assert Assert.NotNull(testData); // Re-Act var desTestObject = await DeserializeAsZeroFormatAsync <ZeroTestHelperObject>(testData).ConfigureAwait(false); // Re-Assert Assert.NotNull(desTestObject); Assert.Equal(testObject.Name, desTestObject.Name); Assert.Equal(testObject.Address, desTestObject.Address); Assert.Equal(testObject.BitsAndPieces, desTestObject.BitsAndPieces); }
public async Task SerializeAsync() { // Arrange var testObject = new ZeroTestHelperObject { Name = "RussianTestObject", Address = "1600 Pennsylvania Ave.", BitsAndPieces = new List <string> { "russianoperative", "spraytan", "traitor", "peetape", "kompromat" } }; // Act var data = await SerializeAsZeroFormatAsync(testObject); // Assert Assert.NotNull(data); }
public async Task PublishAndGetAsync() { // Arrange var queueName = $"{_fixture.TestQueueName2}.3112"; var exchangeName = string.Empty; var testObject = new ZeroTestHelperObject { Name = "RussianTestObject", Address = "1600 Pennsylvania Ave.", BitsAndPieces = new List <string> { "russianoperative", "spraytan", "traitor", "peetape", "kompromat" } }; var envelope = new Envelope { ExchangeName = exchangeName, RoutingKey = queueName, ContentEncoding = ContentEncoding.Binary, MessageType = $"{ContentType.Textplain.Description()}{Charset.Utf8.Description()}" }; // Act var createSuccess = await _fixture.RabbitTopologyService.QueueDeclareAsync(queueName).ConfigureAwait(false); var publishSuccess = await _fixture.RabbitSerializeService.SerializeAndPublishAsync(testObject, envelope).ConfigureAwait(false); await Task.Delay(200).ConfigureAwait(false); // Allow Server Side Routing var result = await _fixture.RabbitSerializeService.GetAndDeserializeAsync <ZeroTestHelperObject>(queueName).ConfigureAwait(false); var deleteSuccess = await _fixture.RabbitTopologyService.QueueDeleteAsync(queueName).ConfigureAwait(false); // Assert Assert.True(createSuccess, "Queue was not created."); Assert.True(publishSuccess, "Message failed to publish."); Assert.True(result != null, "Result was null."); Assert.True(deleteSuccess); }