当前位置: 首页>>代码示例>>C#>>正文


C# Utilities.Random.Random.NextString方法代码示例

本文整理汇总了C#中Utilities.Random.Random.NextString方法的典型用法代码示例。如果您正苦于以下问题:C# Utilities.Random.Random.NextString方法的具体用法?C# Utilities.Random.Random.NextString怎么用?C# Utilities.Random.Random.NextString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utilities.Random.Random的用法示例。


在下文中一共展示了Utilities.Random.Random.NextString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: All

 public void All()
 {
     Utilities.SQL.MicroORM.MicroORM.Database("Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false");
     Utilities.SQL.MicroORM.MicroORM.Map<ObjectClass1>("TestTable", "ID_")
             .Map(x => x.ID, "ID_")
             .Map(x => x.StringValue, "StringValue_", 100)
             .Map(x => x.FloatValue, "FloatValue_")
             .Map(x => x.BoolValue, "BoolValue_")
             .Map(x => x.LongValue, "LongValue_");
     ObjectClass1 TempObject = null;
     Utilities.Random.Random Rand = new Utilities.Random.Random();
     using (Utilities.SQL.MicroORM.MicroORM ORM = new Utilities.SQL.MicroORM.MicroORM())
     {
         for (int x = 0; x < 100; ++x)
         {
             TempObject = new ObjectClass1();
             TempObject.StringValue = Rand.NextString(10);
             TempObject.BoolValue = Rand.NextBool();
             TempObject.FloatValue = (float)Rand.NextDouble();
             TempObject.LongValue =Rand.Next();
             ORM.Map<ObjectClass1>().Save<int>(TempObject);
         }
         TempObject = null;
         IEnumerable<ObjectClass1> Objects = ORM.Map<ObjectClass1>().All();
         Assert.Equal(100, Objects.Count());
     }
 }
开发者ID:JKLFA,项目名称:Craig-s-Utility-Library,代码行数:27,代码来源:MicroORM.cs

示例2: RandomTest

 public void RandomTest()
 {
     Bag<string> BagObject = new Bag<string>();
     Utilities.Random.Random Rand = new Utilities.Random.Random();
     for (int x = 0; x < 10; ++x)
     {
         string Value = Rand.NextString(10);
         int Count = Rand.Next(1, 10);
         for(int y=0;y<Count;++y)
             BagObject.Add(Value);
         Assert.Equal(Count, BagObject[Value]);
     }
     Assert.Equal(10, BagObject.Count);
 }
开发者ID:JKLFA,项目名称:Craig-s-Utility-Library,代码行数:14,代码来源:Bag.cs

示例3: All

 public void All()
 {
     using (Mapping<ObjectClass1> TestObject = new Mapping<ObjectClass1>("Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false", "TestTable", "ID_"))
     {
         TestObject.Map(x => x.ID, "ID_")
             .Map(x => x.StringValue, "StringValue_", 100)
             .Map(x => x.FloatValue, "FloatValue_")
             .Map(x => x.BoolValue, "BoolValue_")
             .Map(x => x.LongValue, "LongValue_")
             .Map(x => x.StringMaxValue, "StringMaxValue_", -1);
         Utilities.Random.Random Rand = new Utilities.Random.Random(12345);
         ObjectClass1 TempObject = new ObjectClass1();
         TempObject.StringValue = "Test String";
         TempObject.BoolValue = true;
         TempObject.FloatValue = 1234.5f;
         TempObject.LongValue = 12345;
         TempObject.StringMaxValue = Rand.NextString(6000);
         TestObject.Save<int>(TempObject);
         IEnumerable<ObjectClass1> Objects = TestObject.All();
         Assert.Equal(1, Objects.Count());
         foreach (ObjectClass1 Item in Objects)
         {
             Assert.Equal("Test String", Item.StringValue);
             Assert.Equal(1234.5f, Item.FloatValue);
             Assert.Equal(true, Item.BoolValue);
             Assert.Equal(12345, Item.LongValue);
             Assert.Equal(1, Item.ID);
             Assert.Equal(TempObject.StringMaxValue, Item.StringMaxValue);
         }
         List<ObjectClass1> Objects2 = new List<ObjectClass1>();
         Rand = new Utilities.Random.Random();
         for (int x = 0; x < 10; ++x)
         {
             TempObject = new ObjectClass1();
             TempObject.StringValue = Rand.NextString(10);
             TempObject.BoolValue = Rand.NextBool();
             TempObject.FloatValue = (float)Rand.NextDouble();
             TempObject.LongValue = Rand.Next(0, 100);
             TempObject.StringMaxValue = Rand.NextString(6000);
             Objects2.Add(TempObject);
         }
         TestObject.Save<int>(Objects2);
         Objects = TestObject.All();
         Assert.Equal(11, Objects.Count());
     }
 }
开发者ID:jiguixin,项目名称:Craig-s-Utility-Library,代码行数:46,代码来源:Mapping.cs

示例4: NextStringTest

 public void NextStringTest()
 {
     Utilities.Random.Random Rand = new Utilities.Random.Random();
     Assert.Equal(10, Rand.NextString(10).Length);
 }
开发者ID:JKLFA,项目名称:Craig-s-Utility-Library,代码行数:5,代码来源:Random.cs

示例5: Paged

 public void Paged()
 {
     using (Mapping<ObjectClass1> TestObject = new Mapping<ObjectClass1>("Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false", "TestTable", "ID_"))
     {
         TestObject.Map(x => x.ID, "ID_")
             .Map(x => x.StringValue, "StringValue_", 100)
             .Map(x => x.FloatValue, "FloatValue_")
             .Map(x => x.BoolValue, "BoolValue_")
             .Map(x => x.LongValue, "LongValue_");
         List<ObjectClass1> Objects2 = new List<ObjectClass1>();
         Utilities.Random.Random Rand = new Utilities.Random.Random();
         for (int x = 0; x < 115; ++x)
         {
             ObjectClass1 TempObject = new ObjectClass1();
             TempObject.StringValue = Rand.NextString(10);
             TempObject.BoolValue = Rand.NextBool();
             TempObject.FloatValue = (float)Rand.NextDouble();
             TempObject.LongValue = Rand.Next(0, 100);
             Objects2.Add(TempObject);
         }
         TestObject.Save<int>(Objects2);
         IEnumerable<ObjectClass1> Objects = TestObject.Paged();
         Assert.Equal(25, Objects.Count());
         Objects = TestObject.Paged(CurrentPage:1);
         Assert.Equal(25, Objects.Count());
         Objects = TestObject.Paged(CurrentPage: 2);
         Assert.Equal(25, Objects.Count());
         Objects = TestObject.Paged(CurrentPage: 3);
         Assert.Equal(25, Objects.Count());
         Objects = TestObject.Paged(CurrentPage: 4);
         Assert.Equal(15, Objects.Count());
         Assert.Equal(5, TestObject.PageCount());
     }
 }
开发者ID:JKLFA,项目名称:Craig-s-Utility-Library,代码行数:34,代码来源:Mapping.cs

示例6: Update

 public void Update()
 {
     using (Mapping<ObjectClass1> TestObject = new Mapping<ObjectClass1>("Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false", "TestTable", "ID_"))
     {
         TestObject.Map(x => x.ID, "ID_")
             .Map(x => x.StringValue, "StringValue_", 100)
             .Map(x => x.FloatValue, "FloatValue_")
             .Map(x => x.BoolValue, "BoolValue_")
             .Map(x => x.LongValue, "LongValue_")
             .Map(x => x.StringMaxValue, "StringMaxValue_", -1);
         Utilities.Random.Random Rand = new Utilities.Random.Random(12346);
         ObjectClass1 TempObject = new ObjectClass1();
         TempObject.StringValue = "Test";
         TempObject.BoolValue = false;
         TempObject.FloatValue = 1.5f;
         TempObject.LongValue = 12;
         TempObject.StringMaxValue = Rand.NextString(6000);
         TempObject.ID = TestObject.Insert<int>(TempObject);
         Rand = new Utilities.Random.Random(12345);
         TempObject.StringValue = "Test String";
         TempObject.BoolValue = true;
         TempObject.FloatValue = 1234.5f;
         TempObject.LongValue = 12345;
         TempObject.StringMaxValue = Rand.NextString(6000);
         TestObject.Update(TempObject);
         using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT * FROM TestTable", "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false", CommandType.Text))
         {
             Helper.ExecuteReader();
             if (Helper.Read())
             {
                 Assert.Equal("Test String", Helper.GetParameter<string>("StringValue_", ""));
                 Assert.Equal(1234.5f, Helper.GetParameter<float>("FloatValue_", 0));
                 Assert.Equal(true, Helper.GetParameter<bool>("BoolValue_", false));
                 Assert.Equal(12345, Helper.GetParameter<long>("LongValue_", 0));
                 Assert.Equal(TempObject.ID, Helper.GetParameter<int>("ID_", 0));
                 Assert.Equal(TempObject.StringMaxValue, Helper.GetParameter<string>("StringMaxValue_", ""));
             }
             else
             {
                 Assert.Fail("Nothing was inserted");
             }
         }
     }
 }
开发者ID:jiguixin,项目名称:Craig-s-Utility-Library,代码行数:44,代码来源:Mapping.cs

示例7: Delete

        public void Delete()
        {
            using (Mapping<ObjectClass1> TestObject = new Mapping<ObjectClass1>("Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false", "TestTable", "ID_"))
            {
                TestObject.Map(x => x.ID, "ID_")
                    .Map(x => x.StringValue, "StringValue_", 100)
                    .Map(x => x.FloatValue, "FloatValue_")
                    .Map(x => x.BoolValue, "BoolValue_")
                    .Map(x => x.LongValue, "LongValue_")
                    .Map(x => x.StringMaxValue, "StringMaxValue_", -1);
                Utilities.Random.Random Rand = new Utilities.Random.Random();
                ObjectClass1 TempObject = new ObjectClass1();
                TempObject.StringValue = "Test";
                TempObject.BoolValue = false;
                TempObject.FloatValue = 1.5f;
                TempObject.LongValue = 12;
                TempObject.StringMaxValue = Rand.NextString(6000);
                TestObject.Save<int>(TempObject);
                Assert.Equal(1, TestObject.Delete(TempObject));

                using (Utilities.SQL.SQLHelper Helper = new Utilities.SQL.SQLHelper("SELECT COUNT(*) AS ItemCount FROM TestTable", "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false", CommandType.Text))
                {
                    Helper.ExecuteReader();
                    if (Helper.Read())
                    {
                        Assert.Equal(0, Helper.GetParameter<int>("ItemCount", -1));
                    }
                    else
                    {
                        Assert.Fail("Nothing was inserted");
                    }
                }
            }
        }
开发者ID:jiguixin,项目名称:Craig-s-Utility-Library,代码行数:34,代码来源:Mapping.cs

示例8: Any

 public void Any()
 {
     using (Mapping<ObjectClass1> TestObject = new Mapping<ObjectClass1>("Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false", "TestTable", "ID_"))
     {
         TestObject.Map(x => x.ID, "ID_")
             .Map(x => x.StringValue, "StringValue_", 100)
             .Map(x => x.FloatValue, "FloatValue_")
             .Map(x => x.BoolValue, "BoolValue_")
             .Map(x => x.LongValue, "LongValue_")
             .Map(x => x.StringMaxValue, "StringMaxValue_", -1);
         Utilities.Random.Random Rand = new Utilities.Random.Random(12345);
         ObjectClass1 TempObject = new ObjectClass1();
         TempObject.StringValue = "Test String";
         TempObject.BoolValue = true;
         TempObject.FloatValue = 1234.5f;
         TempObject.LongValue = 12345;
         TempObject.StringMaxValue = Rand.NextString(6000);
         string StringMaxValue = TempObject.StringMaxValue;
         TestObject.Save<int>(TempObject);
         TempObject = TestObject.Any();
         Assert.Equal("Test String", TempObject.StringValue);
         Assert.Equal(1234.5f, TempObject.FloatValue);
         Assert.Equal(true, TempObject.BoolValue);
         Assert.Equal(12345, TempObject.LongValue);
         Assert.Equal(1, TempObject.ID);
         Assert.Equal(StringMaxValue, TempObject.StringMaxValue);
     }
 }
开发者ID:jiguixin,项目名称:Craig-s-Utility-Library,代码行数:28,代码来源:Mapping.cs


注:本文中的Utilities.Random.Random.NextString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。