public void TestConvertEmptyModel() { var input = new SCTagList(); const string expected = ""; var actual = tagListConverter.Convert(input); Assert.AreEqual(expected, actual); }
public void TestConvertString() { var expected = new SCTagList { Tags = new[] { "one", "two", "three four" }, MachineTags = new[] { new SCMachineTag { Namespace = "five", Key = "six", Value = "seven" }, new SCMachineTag { Namespace = "eight", Key = "nine", Value = "ten eleven twelve" } } }; var actual = tagListConverter.Convert("one two \"three four\" five:six=seven \"eight:nine=ten eleven twelve\""); Assert.AreEqual(jsonSerializer.Serialize(expected), jsonSerializer.Serialize(actual)); }
public void TestConvertModel() { var input = new SCTagList { Tags = new[] { "one", "two", "three four" }, MachineTags = new[] { new SCMachineTag { Namespace = "five", Key = "six", Value = "seven" }, new SCMachineTag { Namespace = "eight", Key = "nine", Value = "ten eleven twelve" } } }; const string expected = "one two \"three four\" five:six=seven \"eight:nine=ten eleven twelve\""; var actual = tagListConverter.Convert(input); Assert.AreEqual(expected, actual); }
public string Convert(SCTagList tagList) { return string.Join(whitespace.ToString(), tagList.Tags.Select(QuotesScreen).Concat(tagList.MachineTags.Select(x => QuotesScreen(string.Format("{0}:{1}={2}", x.Namespace, x.Key, x.Value))))); }
public void TestConvertEmptyString(string input) { var expected = new SCTagList(); var actual = tagListConverter.Convert(input); Assert.AreEqual(jsonSerializer.Serialize(expected), jsonSerializer.Serialize(actual)); }