Ejemplo n.º 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 <primaryKey3, primaryKey> .remote table = new memoryDatabaseModelTable <primaryKey3, primaryKey> .remote(new fastCSharp.memoryDatabase.physicalServer.tcpClient(tcpServer), cache = new dictionary <primaryKey3, primaryKey>(), memoryDatabaseTable.serializeType.Json))
                        {
                            updateMember = table.CreateMemberMap().Append(value => value.Int);
                            cache.WaitLoad();
                            if (cache.Count == 0)
                            {
                                primaryKey3 int1 = table.Insert(new primaryKey3 {
                                    Key1 = 1, Key2 = "1", Key3 = Guid.NewGuid(), Int = 1, String = "A大A"
                                }, false);
                                primaryKey3 intOld2 = new primaryKey3 {
                                    Key1 = 2, Key2 = "2", Key3 = Guid.NewGuid(), Int = 2
                                };
                                primaryKey3 int2 = table.Insert(intOld2);
                                primaryKey3 int4 = table.Insert(new primaryKey3 {
                                    Key1 = 2, Key2 = "2", Key3 = Guid.NewGuid(), Int = 4
                                });
                                if (int1 == null)
                                {
                                    return(false);
                                }
                                if (int2 == null)
                                {
                                    return(false);
                                }
                                if (int4 == null)
                                {
                                    return(false);
                                }

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

                                return(check(table, false));
                            }
                            return(check(table, true));
                        }
                    }
                }
                return(false);
            }
Ejemplo n.º 2
0
            internal static bool TestCase()
            {
                using (memoryDatabaseModelTable <primaryKey3, primaryKey> table = new memoryDatabaseModelTable <primaryKey3, primaryKey>(cache = new dictionary <primaryKey3, primaryKey>(), memoryDatabaseTable.serializeType.Json, "localPrimaryKey3"))
                {
                    updateMember = table.CreateMemberMap().Append(value => value.Int);
                    cache.WaitLoad();
                    if (cache.Count == 0)
                    {
                        primaryKey3 int1 = table.Insert(new primaryKey3 {
                            Key1 = 1, Key2 = "1", Key3 = Guid.NewGuid(), Int = 1, String = "A大A"
                        }, false);
                        primaryKey3 intOld2 = new primaryKey3 {
                            Key1 = 2, Key2 = "2", Key3 = Guid.NewGuid(), Int = 2
                        };
                        primaryKey3 int2 = table.Insert(intOld2);
                        primaryKey3 int4 = table.Insert(new primaryKey3 {
                            Key1 = 2, Key2 = "2", Key3 = Guid.NewGuid(), Int = 4
                        });
                        if (int1 == null)
                        {
                            return(false);
                        }
                        if (int2 == null)
                        {
                            return(false);
                        }
                        if (int4 == null)
                        {
                            return(false);
                        }

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

                        return(check(table, false));
                    }
                    return(check(table, true));
                }
            }