public void WhenRightWithSamePrimitiveTypesThenSerializesOk() { // Arrange var settings = GetSettings(); EitherStrict <int, int> data = EitherStrict.Right <int, int>(22); // Act string json = JsonConvert.SerializeObject(data, settings); // Assert Assert.AreEqual("{\"Right\":22}", json); }
public void WhenItsRightWithDifferentPrimitiveTypesThenSerializesOk() { // Arrange var settings = GetSettings(); EitherStrict <int, string> data = "Hola"; // Act string json = JsonConvert.SerializeObject(data, settings); // Assert Assert.AreEqual("{\"Right\":\"Hola\"}", json); }
public void WhenNestedEitherThenSerializesOkCase1() { // Arrange var settings = GetSettings(); EitherStrict <EitherStrict <int, int>, int> data = EitherStrict.Left <EitherStrict <int, int>, int>(EitherStrict.Left <int, int>(10)); // Act string json = JsonConvert.SerializeObject(data, settings); // Assert Assert.AreEqual("{\"Left\":{\"Left\":10}}", json); }
public void WhenNestedEitherThenSerializesOkCase3() { // Arrange var settings = GetSettings(); EitherStrict <EitherStrict <int, int>, int> data = EitherStrict.Right <EitherStrict <int, int>, int>(30); // Act string json = JsonConvert.SerializeObject(data, settings); // Assert Assert.AreEqual("{\"Right\":30}", json); }
public void WhenClassTypeWithNestedEitherThenSerializesOkCase3() { // Arrange var settings = GetSettings(); EitherStrict <EitherConverterExample2, int> data = 10; // Act string json = JsonConvert.SerializeObject(data, settings); // Assert Assert.AreEqual("{\"Right\":10}", json); }