Exemple #1
0
            internal static bool RemoteTestCase()
            {
                typeof(fastCSharp.config.pub).GetProperty("IsDebug", BindingFlags.Instance | BindingFlags.Public).SetValue(fastCSharp.config.pub.Default, true, null);
                using (fastCSharp.memoryDatabase.physicalServer.tcpServer server = new fastCSharp.memoryDatabase.physicalServer.tcpServer(tcpServer))
                {
                    if (server.Start())
                    {
                        using (memoryDatabaseModelTable <primaryKey, int> .remote table = new memoryDatabaseModelTable <primaryKey, int> .remote(new fastCSharp.memoryDatabase.physicalServer.tcpClient(tcpServer), cache = new fastCSharp.memoryDatabase.cache.searchTree <primaryKey, int>(), memoryDatabaseTable.serializeType.Data))
                        {
                            updateMember = table.CreateMemberMap().Append(value => value.Int);
                            cache.WaitLoad();
                            if (cache.Count == 0)
                            {
                                primaryKey int1 = table.Insert(new primaryKey {
                                    Key = 1, Int = 1, String = "A大A"
                                }, false);
                                primaryKey intOld2 = new primaryKey {
                                    Key = 2, Int = 2
                                };
                                primaryKey int2 = table.Insert(intOld2);
                                primaryKey int4 = table.Insert(new primaryKey {
                                    Key = 3, Int = 4
                                });
                                if (int1 == null)
                                {
                                    return(false);
                                }
                                if (int2 == null)
                                {
                                    return(false);
                                }
                                if (int4 == null)
                                {
                                    return(false);
                                }

                                intOld2.Int = 3;
                                primaryKey int3 = table.Update(intOld2, updateMember);
                                if (int3 == null)
                                {
                                    return(false);
                                }
                                primaryKey delete = table.Delete(int4.Key);
                                if (delete == null)
                                {
                                    return(false);
                                }

                                return(check(table, false));
                            }
                            return(check(table, true));
                        }
                    }
                }
                return(false);
            }
Exemple #2
0
            internal static bool TestCase()
            {
                using (memoryDatabaseModelTable <primaryKey, int> table = new memoryDatabaseModelTable <primaryKey, int>(cache = new fastCSharp.memoryDatabase.cache.searchTree <primaryKey, int>(), memoryDatabaseTable.serializeType.Data, "localPrimaryKey"))
                {
                    updateMember = table.CreateMemberMap().Append(value => value.Int);
                    cache.WaitLoad();
                    if (cache.Count == 0)
                    {
                        primaryKey int1 = table.Insert(new primaryKey {
                            Key = 1, Int = 1, String = "A大A"
                        }, false);
                        primaryKey intOld2 = new primaryKey {
                            Key = 2, Int = 2
                        };
                        primaryKey int2 = table.Insert(intOld2);
                        primaryKey int4 = table.Insert(new primaryKey {
                            Key = 3, Int = 4
                        });
                        if (int1 == null)
                        {
                            return(false);
                        }
                        if (int2 == null)
                        {
                            return(false);
                        }
                        if (int4 == null)
                        {
                            return(false);
                        }

                        intOld2.Int = 3;
                        primaryKey int3 = table.Update(intOld2, updateMember);
                        if (int3 == null)
                        {
                            return(false);
                        }
                        primaryKey delete = table.Delete(int4.Key);
                        if (delete == null)
                        {
                            return(false);
                        }

                        return(check(table, false));
                    }
                    return(check(table, true));
                }
            }
 var(primaryKey, secondaryKey) = key;