This repository has been archived by the owner on Aug 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added json attributes and refactored in Enum string converter seriali…
…zation.
- Loading branch information
Showing
8 changed files
with
102 additions
and
17 deletions.
There are no files selected for viewing
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,10 @@ | ||
namespace SharpRaven.Data | ||
{ | ||
/// <summary> | ||
/// This defines the level of the event. If not provided it defaults to info which is the middle level. In the order of priority from highest to lowest the levels are critical, error, warning, info and debug. Levels are used in the UI to emphasize and deemphasize the crumb. | ||
/// </summary> | ||
public enum BreadcrumbsLevel | ||
{ | ||
Critical, Error, Warning, Info, Debug | ||
} | ||
} |
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
56 changes: 56 additions & 0 deletions
56
src/tests/SharpRaven.UnitTests/Serialization/LowerInvariantConverterTests.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,56 @@ | ||
using Newtonsoft.Json; | ||
|
||
using NSubstitute; | ||
|
||
using NUnit.Framework; | ||
|
||
using SharpRaven.Serialization; | ||
|
||
namespace SharpRaven.UnitTests.Serialization { | ||
[TestFixture] | ||
public class LowerInvariantConverterTests { | ||
[TestCase(EnumTestable.One, "one")] | ||
[TestCase(EnumTestable.Two, "two")] | ||
[TestCase(EnumTestable.ThreE, "three")] | ||
public void Should_Convert_Enum_To_Lowercase(EnumTestable enumTestable, string result) | ||
{ | ||
var lowerInvariantConverter = new LowerInvariantConverter(); | ||
|
||
var jsonWriter = Substitute.For<JsonWriter>(); | ||
|
||
lowerInvariantConverter.WriteJson(jsonWriter, enumTestable, Substitute.For<JsonSerializer>()); | ||
|
||
jsonWriter.Received().WriteValue(result); | ||
} | ||
|
||
[Test] | ||
public void Should_Not_Call_Write_Null_value() | ||
{ | ||
var lowerInvariantConverter = new LowerInvariantConverter(); | ||
|
||
var jsonWriter = Substitute.For<JsonWriter>(); | ||
|
||
lowerInvariantConverter.WriteJson(jsonWriter, null, Substitute.For<JsonSerializer>()); | ||
|
||
jsonWriter.DidNotReceiveWithAnyArgs().WriteValue(""); | ||
} | ||
|
||
[Test] | ||
public void Should_Not_Call_Write_If_Not_Enum_Object() | ||
{ | ||
var lowerInvariantConverter = new LowerInvariantConverter(); | ||
|
||
var jsonWriter = Substitute.For<JsonWriter>(); | ||
|
||
lowerInvariantConverter.WriteJson(jsonWriter, "any string", Substitute.For<JsonSerializer>()); | ||
|
||
jsonWriter.DidNotReceiveWithAnyArgs().WriteValue(""); | ||
} | ||
|
||
|
||
public enum EnumTestable | ||
{ | ||
One, Two, ThreE | ||
} | ||
} | ||
} |
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