这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@colombod
Copy link
Member

serialized kernel command are serialized with camlCase convention

{
public class StreamKernelCommand
{
[JsonProperty("id")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need both this and the CamelCasePropertyNamesContractResolver?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the contract resolver is to force the properties of nested objects

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood, but then why are the attributes needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to have them if the y get serialized outside of the api. Ideally i'd stick them on the domain commands and events

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that happens then the contract on the nested objects would be broken anyway.

For this reason I often make serialization-specific wrapper classes internal. The serialized output is the contract, and the class is an implementation detail that isn't intended to be used for other purposes.

var kernel = new CompositeKernel()
{
new CSharpKernel(),
new FakeKernel("fake")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the FakeKernel needed for this test?


events.Should()
.NotContain(e => e.EventType == nameof(CommandNotRecognized));
this.Assent(text, _configuration);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be overly strict. Assent should be used for tests that are explicitly contract tests. This was (until now, and in terms of naming) a test of functionality. We should separate these so test failures are more informative and functional tests are resilient to normal refactoring.

@colombod colombod requested a review from jonsequitur August 30, 2019 19:01
@colombod colombod merged commit 95b13ff into dotnet:master Aug 30, 2019
@colombod colombod deleted the feature/alig_json_serialization branch August 30, 2019 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants