private void ReferenceTypeWithReferenceTypesEncodeTest_Run(IDbContext context, ref Expr lastQuery) { var model = new ReferenceTypesReferenceModel { ReferenceModel = new ReferenceModel { Id = "test1", Indexed2 = "test2" }, ReferenceModels1 = new List <ReferenceModel> { new ReferenceModel { Id = "test3", Indexed2 = "test4" }, new ReferenceModel { Id = "test5", Indexed2 = "test6" } }, ReferenceModels2 = new [] { new ReferenceModel { Id = "test7", Indexed2 = "test8" }, new ReferenceModel { Id = "test9", Indexed2 = "test10" } } }; var manual = Obj(new Dictionary <string, object> { { "indexed1", null }, { "reference_model", Ref("test1") }, { "reference_models1", new object[] { Ref("test3"), Ref("test5") } }, { "reference_models2", new object[] { Ref("test7"), Ref("test9") } } }); Assert.Equal(JsonConvert.SerializeObject(manual), JsonConvert.SerializeObject(context.ToFaunaObj(model))); }
private static void ReferenceTypeWithReferenceTypesDecodeTest_Run(IDbContext context, ref Expr lastQuery) { var model = new ReferenceTypesReferenceModel { ReferenceModel = new ReferenceModel { Id = "test1", Indexed2 = "test2" }, ReferenceModels1 = new List <ReferenceModel> { new ReferenceModel { Id = "test3", Indexed2 = "test4" }, new ReferenceModel { Id = "test5", Indexed2 = "test6" } }, ReferenceModels2 = new [] { new ReferenceModel { Id = "test7", Indexed2 = "test8" }, new ReferenceModel { Id = "test9", Indexed2 = "test10" } } }; var result = context.Get <ReferenceTypesReferenceModel>("test").Result; Assert.Equal(model, result); }
protected bool Equals(ReferenceTypesReferenceModel other) { return(string.Equals(Id, other.Id) && Equals(ReferenceModel, other.ReferenceModel) && (ReferenceModels1?.SequenceEqual(other.ReferenceModels1) ?? other.ReferenceModels1 == null) && (ReferenceModels2?.SequenceEqual(other.ReferenceModels2) ?? other.ReferenceModels2 == null)); }