public void ConvertObjectShouldReturnCorrectJson() { string expectedJson = "{\n \"testKey1\": \"testValue\",\n \"testKey2\": \"testValue\"\n}"; var openApiObject = new OpenApiObject { { "testKey1", new OpenApiString("testValue") }, { "testKey2", new OpenApiString("testValue") } }; var jsonValue = OpenApiAnyConvertor.GetJsonValue(openApiObject); Assert.AreEqual(expectedJson, jsonValue); }
public void ConvertDateTimePrimitiveShouldReturnCorrectValue() { var primitiveValue = OpenApiAnyConvertor.GetPrimitiveValue(new OpenApiDateTime(DateTime.UnixEpoch)); Assert.AreEqual("01/01/1970 00:00:00 +00:00", primitiveValue); }
public void ConvertBinaryPrimitiveShouldReturnCorrectValue() { var primitiveValue = OpenApiAnyConvertor.GetPrimitiveValue(new OpenApiBinary(new byte[] { 7, 8 })); Assert.AreEqual("0000011100001000", primitiveValue); }
public void ConvertBytePrimitiveShouldReturnCorrectValue() { var primitiveValue = OpenApiAnyConvertor.GetPrimitiveValue(new OpenApiByte(new byte[] { 7, 8 })); Assert.AreEqual("\a\b", primitiveValue); }
public void ConvertIntegerPrimitiveShouldReturnCorrectValue() { Assert.AreEqual("5", OpenApiAnyConvertor.GetPrimitiveValue(new OpenApiInteger(5))); }
public void ConvertBooleanPrimitiveShouldReturnCorrectValue() { Assert.AreEqual("True", OpenApiAnyConvertor.GetPrimitiveValue(new OpenApiBoolean(true))); }
public void ConvertStringPrimitiveShouldReturnCorrectValue() { string value = "test"; Assert.AreEqual(value, OpenApiAnyConvertor.GetPrimitiveValue(new OpenApiString(value))); }