public void The_metadata_is_retrieved() { Assert.That(last_http_response.StatusCode, Is.EqualTo(HttpStatusCode.OK)); var content = last_http_response.Content.ReadAsStringAsync().Result; var metaData = new BsonConverter().Deserialise <Metadata>(content); Assert.That(metaData.Questions.Count, Is.EqualTo(2)); var categoryQuestion = metaData.Questions[0]; var categoryOptions = categoryQuestion.UnmappedProperties["options"]; Assert.That(categoryQuestion.Title, Is.EqualTo("Category")); Assert.That(categoryQuestion.Id, Is.EqualTo("category")); Assert.That(categoryOptions, Is.EquivalentTo(new List <string> { "Watches", "Rings" })); var subcategoryQuestion = metaData.Questions[1]; var subcategoryOptions = subcategoryQuestion.UnmappedProperties["options"]; Assert.That(subcategoryQuestion.Id, Is.EqualTo("subCategory")); Assert.That(subcategoryQuestion.Title, Is.EqualTo("Sub category")); Assert.That(subcategoryOptions, Is.EquivalentTo(new List <string> { "Bracelets", "Toe rings" })); }
public void The_product_is_retrieved() { Assert.That(last_http_response.StatusCode, Is.EqualTo(HttpStatusCode.OK)); var content = last_http_response.Content.ReadAsStringAsync().Result; var product = new BsonConverter().Deserialise <Product>(content); Assert.That(product.Id, Is.EqualTo(GetOrCreateRandomId(false))); Assert.That(product.UnmappedProperties["description"], Is.EqualTo("a test")); Assert.That(product.UnmappedProperties["title"], Is.EqualTo("title")); }
public byte[] ToByteArray() { return(BsonConverter.ToByteArray <JObject>(this)); }
protected GameMessage(byte[] bytes) : this(BsonConverter.FromByteArray <JObject>(bytes)) { }
public static JsonRpc Parse(byte[] bytes) { return(new JsonRpc(BsonConverter.FromByteArray <JObject>(bytes))); }
// byte array -> jobject public static JObject ToJObject(this byte[] bytes) { return(BsonConverter.FromByteArray <JObject>(bytes)); }
// jobject -> byte array public static byte[] ToByteArray(this JObject o) { return(BsonConverter.ToByteArray(o)); }