Skip to content

Conversation

@axunonb
Copy link
Member

@axunonb axunonb commented Mar 23, 2021

  • Introduced new class SerializerOptions
  • YAXSerializer(Type, SerializerOptions) is the only constructor not flagged as obsolete
  • Moved all relevant YAXSerializer variables to SerializerOptions and marked YAXSerializer properties as obsolete. These properties now read/write SerializerOptions
  • Corrected typos in private fields/methods of YAXSerializer
  • Corrected typos in comments and xmldoc

Implementing CultureInfoas pointed out in #80 will follow in the next step

@axunonb axunonb marked this pull request as draft March 23, 2021 22:30
@axunonb
Copy link
Member Author

axunonb commented Mar 23, 2021

@304NotModified @NKnusperer Unit test for SerializerOptions will be added to the PR draft after general comments about this solution.

@axunonb axunonb added this to the v3 milestone Mar 23, 2021
@axunonb axunonb marked this pull request as ready for review March 24, 2021 19:38
@304NotModified
Copy link
Collaborator

nice work! 🎉 I have some suggestions!

@codecov-io
Copy link

codecov-io commented Mar 24, 2021

Codecov Report

Merging #137 (7443860) into master (a5ebe3f) will increase coverage by 0%.
The diff coverage is 70%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #137   +/-   ##
=====================================
  Coverage      76%    76%           
=====================================
  Files          57     60    +3     
  Lines        3743   3760   +17     
  Branches      760    760           
=====================================
+ Hits         2845   2867   +22     
+ Misses        681    676    -5     
  Partials      217    217           
Impacted Files Coverage Δ
YAXLib/YAXSerializer.cs 73% <63%> (+<1%) ⬆️
YAXLib/Options/SerializerOptions.cs 100% <100%> (ø)
YAXLib/Options/YAXAttributeName.cs 100% <100%> (ø)
YAXLib/Options/YAXNameSpace.cs 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a5ebe3f...7443860. Read the comment docs.

Copy link
Collaborator

@304NotModified 304NotModified left a comment

Choose a reason for hiding this comment

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

Looks great,

Have some recommendation, but I like the structure so approval for now.

One thing I'm doubting about, the names of classes YAXAttributeName and YAXNameSpace. I would expect something like YaxAttributeNameOptions and YAXNameSpaceOptions. What do you guys think?

var opt = GetNonDefaultOptions();
var ser = new YAXSerializer(typeof(SerializerOptions), opt);

Assert.IsTrue(ser.DefaultExceptionType == opt.ExceptionBehavior);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This isn't really what I meant :)

If the test fails, we will see IsTrue(false) failed , some something like that. Then we can't see on the build server what's wrong and we need to check it locally (same for IsFalse etc)

I would recommend to do:

Assert.AreEqual (ser.DefaultExceptionType, opt.ExceptionBehavior, "ExceptionBehavior"); 

etc. (not 100% about the syntax, not double checked)

If you don't like writing all those description strings, than FluentAssertions helps on that:

ser.DefaultExceptionType.Should().Be(opt.ExceptionBehavior); // This will give nice  DefaultExceptionType in the message

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it, will modify

@axunonb axunonb merged commit 767f9f1 into YAXLib:master Mar 28, 2021
@axunonb axunonb deleted the SerializerOptions branch March 29, 2021 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants