public virtual async Task <DynamicObject> CreateAsync(DynamicObject model) { var bsonDocument = BsonDocument.Create(model.ToDynamic()); var insertedDocument = await this._repository.InsertAsync(bsonDocument) as BsonDocument; return(DynamicObject.Create(BsonTypeMapper.MapToDotNetValue(insertedDocument) as Dictionary <string, object>)); }
public When_mapping_list_of_nullable_int() { IEnumerable <int?> list = new List <int?> { null, 1, 11 }; dynamicObject = DynamicObject.Create(list); }
private T Serialize <T>(T source) { var dynamicSourceObject = DynamicObject.Create(source); var dynamicSourceResult = _serialize(dynamicSourceObject); dynamicSourceResult.ShouldNotBeSameAs(dynamicSourceObject); var result = dynamicSourceResult.CreateObject(); result.ShouldNotBeSameAs(source); result.ShouldBeOfType(source.GetType()); return(result.ShouldBeAssignableTo <T>()); }
public When_mapping_empty_int_array() { dynamicObject = DynamicObject.Create(new int[0]); }
public When_mapping_int_array() { dynamicObject = DynamicObject.Create(new[] { 1, 2 }); }
protected When_serializing_dynamicobject_for_typeinfo_of_typeinfo(Func <DynamicObject, DynamicObject> serialize) { dynamicObject = DynamicObject.Create(new TypeInfo(typeof(TypeInfo), true)); serializedDynamicObject = serialize(dynamicObject); }
public When_mapping_string_array() { dynamicObject = DynamicObject.Create(new[] { "One", "Two" }); }
public When_mapping_empty_list() { dynamicObject = DynamicObject.Create(new List <string>()); }
public When_mapping_list_of_string() { dynamicObject = DynamicObject.Create(new List <string> { "One", "Two" }); }