コード例 #1
0
 public static DummyCacheObject GenerateCacheObject()
 {
     return(new DummyCacheObject
     {
         Id = NextId(),
         Name = "CacheObject_" + RandomText.Word(),
         Resource = RandomText.Stuff() + RandomText.Word()
     });
 }
コード例 #2
0
 public static GuideV1 CreateGuide()
 {
     return(new GuideV1
     {
         Id = IdGenerator.NextLong(),
         Name = RandomText.Name(),
         Type = RandomGuideType(),
         App = RandomText.Phrase(1, 50),
         MinVer = RandomLong.NextLong(int.MaxValue),
         MaxVer = RandomLong.NextLong(int.MaxValue),
         Tags = new List <string>
         {
             RandomText.Stuff(), IdGenerator.NextLong(), RandomText.Color(), RandomText.Name(), RandomText.Phone(), RandomText.Adjective(), "tag1"
         },
         AllTags = new List <string>
         {
             RandomText.Stuff(), RandomText.Color(), RandomText.Name(), RandomText.Phone(), RandomText.Adjective()
         },
         Status = RandomText.Verb(),
         CreateTime = DateTime.UtcNow,
         Pages = new List <GuidePageV1>
         {
             new GuidePageV1
             {
                 Title = new Dictionary <string, string>
                 {
                     { IdGenerator.NextShort(), RandomText.Word() }, { IdGenerator.NextShort(), RandomText.Word() }
                 },
                 Content = new Dictionary <string, string>
                 {
                     { IdGenerator.NextShort(), RandomText.Word() }, { IdGenerator.NextShort(), RandomText.Word() }
                 },
                 Color = RandomText.Color(),
                 PicId = IdGenerator.NextShort(),
                 PicUri = IdGenerator.NextLong()
             },
             new GuidePageV1
             {
                 Title = new Dictionary <string, string>
                 {
                     { IdGenerator.NextShort(), RandomText.Word() }, { IdGenerator.NextShort(), RandomText.Word() }
                 },
                 Content = new Dictionary <string, string>
                 {
                     { IdGenerator.NextShort(), RandomText.Word() }, { IdGenerator.NextShort(), RandomText.Word() }
                 },
                 Color = RandomText.Color(),
                 PicId = IdGenerator.NextShort(),
                 PicUri = IdGenerator.NextLong()
             }
         }
     });
 }
コード例 #3
0
        public static string[] Tags()
        {
            var count = RandomInteger.NextInteger(0, 5);
            var tags  = new string[count];

            for (var index = 0; index < count; index++)
            {
                tags[index] = RandomText.Word().ToLower();
            }

            return(tags);
        }
コード例 #4
0
        public async Task It_Should_Update_Guide()
        {
            // arrange
            var guide1 = await _client.CreateGuideAsync(null, TestModel.CreateGuide());

            // act
            guide1.Name = RandomText.Word();
            var result = await _client.UpdateGuideAsync(null, guide1);

            // assert
            Assert.NotNull(result);
            TestModel.AssertEqual(guide1, result);
        }
コード例 #5
0
        public async Task It_Should_Update_Guide()
        {
            // arrange
            var guide = await Invoke <GuideV1>("create_guide", new { guide = TestModel.CreateGuide(), paging = _defaultPagingParams, });

            // act
            guide.Name = RandomText.Word();

            var result = await Invoke <GuideV1>("update_guide", new { guide = guide, paging = _defaultPagingParams, });

            // assert
            TestModel.AssertEqual(guide, result);
        }
コード例 #6
0
 public static BeaconV1 CreateBeacon()
 {
     return(new BeaconV1()
     {
         Id = RandomString.NextString(10, 20),
         SiteId = RandomString.NextString(10, 20),
         Type = RandomText.Word(),
         Udi = RandomString.NextString(10, 20),
         Label = RandomText.Word(),
         Center = new CenterObject(RandomText.Word(), new int[] { RandomInteger.NextInteger(1, 10), RandomInteger.NextInteger(1, 10) }),
         Radius = RandomDouble.NextDouble(100.0)
     });
 }