-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: update batching extension method to AddBatching
- Loading branch information
1 parent
ce7b5d7
commit 5750d76
Showing
12 changed files
with
69 additions
and
28 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
samples/KafkaFlow.Sample.BatchOperations/PrintConsoleMiddleware.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/KafkaFlow.UnitTests/Serializers/NewtonsoftJsonDeserializerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
namespace KafkaFlow.UnitTests.Serializers | ||
{ | ||
using System; | ||
using System.IO; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using AutoFixture; | ||
using FluentAssertions; | ||
using KafkaFlow.Serializer; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Moq; | ||
using Newtonsoft.Json; | ||
|
||
[TestClass] | ||
public class NewtonsoftJsonDeserializerTests | ||
{ | ||
private readonly Mock<ISerializerContext> contextMock = new (); | ||
private readonly NewtonsoftJsonDeserializer deserializer = new (); | ||
|
||
private readonly Fixture fixture = new(); | ||
|
||
[TestMethod] | ||
public async Task DeserializeAsync_ValidPayload_ObjectGenerated() | ||
{ | ||
// Arrange | ||
var message = this.fixture.Create<TestMessage>(); | ||
using var input = new MemoryStream(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(message))); | ||
|
||
// Act | ||
var result = await this.deserializer.DeserializeAsync(input, typeof(TestMessage), this.contextMock.Object); | ||
|
||
// Assert | ||
result.Should().NotBeNull(); | ||
result.Should().BeOfType<TestMessage>(); | ||
} | ||
|
||
private class TestMessage | ||
{ | ||
public int IntegerField { get; set; } | ||
|
||
public string StringField { get; set; } | ||
|
||
public double DoubleField { get; set; } | ||
|
||
public DateTime DateTimeField { get; set; } | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...atchConsume/BatchConsumeMessageContext.cs → ...ow/Batching/BatchConsumeMessageContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...es/BatchConsume/BatchConsumeMiddleware.cs → ...kaFlow/Batching/BatchConsumeMiddleware.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters