public void OnlyAllowExpectedCharacters(string key, string value, string expectedKey, string expectedValue)
        {
            var tag = TagFactory.Create(key, value);

            Assert.Equal(expectedKey, tag.Key);
            Assert.Equal(expectedValue, tag.Value);
        }
示例#2
0
文件: Thing.cs 项目: Totokis/TextRPG
 public void BakeToPrefab()
 {
     foreach (var tag in editableList)
     {
         listOfRPGTags.Add(TagFactory.Create(tag));
     }
 }
 public void OnlyIllegalCharsThrowsValueLengthException()
 {
     Assert.Throws <TagValueLengthException>(() =>
     {
         var tag = TagFactory.Create(
             "x", "!");
     });
 }
 public void OnlyIllegalCharsThrowsKeyLengthException()
 {
     Assert.Throws <TagKeyLengthException>(() =>
     {
         var tag = TagFactory.Create(
             "!$£´¨'", "x");
     });
 }
        public void TagValueIsTruncatedIfMoreThan258Characters()
        {
            var tag = TagFactory.Create(
                "x",
                "asdfsadfasdfasdfasdfadsfasdfsadfasdfasdfasdfadsfasdfsadfasdfasdfasdfadsfasdfsadfasdfasdfasdfadsfasdfsadfasdfasdfasdfadsfagfadsgdsfgsdfgasdfsadfasdfasdfasdfadsfasdfsadfasdfasdfasdfadsfasdfsadfasdfasdfasdfadsfasdfsadfasdfasdfasdfadsfasdfsadfasdfasdfasdfadsfagfadsgdsfgsdfg");

            Assert.Equal(256, tag.Value.Length);
        }
        public void TagKeyIsTruncatedIfMoreThan128Characters()
        {
            var tag = TagFactory.Create(
                "asdfsadfasdfasdfasdfadsfasdfsadfasdfasdfasdfadsfasdfsadfasdfasdfasdfadsfasdfsadfasdfasdfasdfadsfasdfsadfasdfasdfasdfadsfagfadsgdsfgsdfg",
                "x");

            Assert.Equal(128, tag.Key.Length);
        }
示例#7
0
        public async Task <Tag> EnsureTagAsync(string name)
        {
            // todo: special charsを含んでいる場合もはじく
            SystemContract.RequireNotNullOrWhiteSpace(name, "name");

            var query = _refsContext.Tags.Include("Statistics").
                        Where(t => t.Name == name);

            var storedTag = await query.SingleOrDefaultAsync();

            if (storedTag == null)
            {
                var tag = TagFactory.Create(name);
                _refsContext.Tags.Add(tag);
                await _refsContext.SaveChangesAsync();

                storedTag = tag;
            }

            return(storedTag);
        }