Пример #1
0
        public int GetSpacing(AdaptiveSpacing spacing)
        {
            switch (spacing)
            {
            case AdaptiveSpacing.None:
                return(0);

            case AdaptiveSpacing.Small:
                return(Spacing.Small);

            case AdaptiveSpacing.Medium:
                return(Spacing.Medium);

            case AdaptiveSpacing.Large:
                return(Spacing.Large);

            case AdaptiveSpacing.ExtraLarge:
                return(Spacing.ExtraLarge);

            case AdaptiveSpacing.Padding:
                return(Spacing.Padding);

            default:
                return(Spacing.Default);
            }
        }
        private void TestSpacing(AdaptiveSpacing expected, string spacingString)
        {
            AdaptiveCard card = AdaptiveCard.FromJson(@"{
  ""type"": ""AdaptiveCard"",
  ""version"": ""1.0"",
  ""body"": [
    {
      ""type"": ""TextBlock"",
      ""text"": ""Adaptive Card design session"",
      ""spacing"": """ + spacingString + @"""
    }
  ]
}").Card;

            AdaptiveTextBlock tb = card.Body[0] as AdaptiveTextBlock;

            Assert.AreEqual(expected, tb.Spacing);

            string json = card.ToJson();
            string str  = $@"""spacing"": ""{spacingString}""";

            if (expected == AdaptiveSpacing.Default)
            {
                Assert.IsFalse(json.Contains(str));
            }
            else
            {
                Assert.IsTrue(json.Contains(str));
            }
        }
Пример #3
0
 public TagContent(AdaptiveSpacing spacing, Grid elementContainer)
 {
     Spacing          = spacing;
     ElementContainer = elementContainer;
 }