コード例 #1
0
            public void ShouldThrowExceptionWhenActionsIsNull()
            {
                ITemplate template = new ButtonsTemplate()
                {
                    ThumbnailUrl = new Uri("https://foo.bar"),
                    Title        = "ButtonsTitle",
                    Text         = "ButtonsText"
                };

                ExceptionAssert.Throws <InvalidOperationException>("The actions cannot be null.", () =>
                {
                    template.Validate();
                });
            }
コード例 #2
0
            public void ShouldThrowExceptionWhenTextIsNull()
            {
                ITemplate template = new ButtonsTemplate()
                {
                    ThumbnailUrl = new Uri("https://foo.bar"),
                    Title        = "ButtonsTitle",
                    Actions      = new[]
                    {
                        new PostbackAction()
                    }
                };

                ExceptionAssert.Throws <InvalidOperationException>("The text cannot be null.", () =>
                {
                    template.Validate();
                });
            }
コード例 #3
0
            public void ShouldNotThrowExceptionWhenValid()
            {
                ITemplate template = new ButtonsTemplate()
                {
                    ThumbnailUrl = new Uri("https://foo.bar"),
                    Title        = "ButtonsTitle",
                    Text         = "ButtonsText",
                    Actions      = new[]
                    {
                        new PostbackAction()
                        {
                            Data = "Foo", Label = "Bar"
                        }
                    }
                };

                template.Validate();
            }