new KeyOptions(CouchValue.MaxValue) fails on Json serialization #24

Closed
uriagassi opened this Issue Jan 18, 2012 · 5 comments

Comments

Projects
None yet
2 participants

ArgumentException: Could not determine JSON object type for type System.Object.

public KeyOptions(params object[] objects)
{
this.objects = new JArray(objects);
}

Owner

soitgoes commented Jan 18, 2012

Do your unit tests pass? Can you write a unit test for me that fails?

This for example works for me.
[Test]
public void KeyOptions_Should_Produce_Squirley_Brackets_for_CouchValueMax()
{
var arry = new KeyOptions();
arry.Add(CouchValue.MaxValue);
arry.Add(1);
var result = arry.ToString();
Assert.AreEqual("[{},1]", result);
}

Owner

soitgoes commented Jan 18, 2012

This works for me as well.

    [Test]
    public void KeyOptions_Constructor_Fails()
    {
        var arry = new KeyOptions(CouchValue.MinValue);
        var result = arry.ToString();
    }

[Test]
public void KeyOptions_Should_Produce_Squirley_Brackets_for_
CouchValueMax()
{
var arry = new KeyOptions(CouchValue.MaxValue, 1);
var result = arry.ToString();
Assert.AreEqual("[{},1]", result);
}

Owner

soitgoes commented Jan 18, 2012

Oh ok. Working on it now.

The workaround is to just add them separately.

Thanks, I've used

new KeyOptions(id, new JRaw("{}"))

soitgoes closed this Jan 18, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment