Example #1
0
        private static void AssertAdaptiveChildInToast(string expectedAdaptiveChildXml, IAdaptiveChild child)
        {
            var binding = new ToastBindingGeneric();

            // If the child isn't text, we need to add a text element so notification is valid
            if (!(child is AdaptiveText))
            {
                binding.Children.Add(new AdaptiveText()
                {
                    Text = "Required text element"
                });

                expectedAdaptiveChildXml = "<text>Required text element</text>" + expectedAdaptiveChildXml;
            }

            binding.Children.Add((IToastBindingGenericChild)child);

            var content = new ToastContent()
            {
                Visual = new ToastVisual()
                {
                    BindingGeneric = binding
                }
            };

            string expectedFinalXml = "<toast><visual><binding template='ToastGeneric'>" + expectedAdaptiveChildXml + "</binding></visual></toast>";

            AssertHelper.AssertToast(expectedFinalXml, content);
        }
 private static void AssertPayload(string expectedXml, ToastContent toast)
 {
     AssertHelper.AssertToast(expectedXml, toast);
 }