public void ShouldPreserveInstanceWhenValueIsCarouselTemplate() { var template = new ImageCarouselTemplate() { Columns = new IImageCarouselColumn[] { new ImageCarouselColumn() { ImageUrl = new Uri("https://foo.bar"), Action = new MessageAction() { Label = "PostbackLabel", Text = "PostbackText" } } } }; var carouselTemplate = ImageCarouselTemplate.Convert(template); Assert.AreSame(template, carouselTemplate); var column = carouselTemplate.Columns.First(); Assert.AreSame(column, carouselTemplate.Columns.First()); }
public void ShouldThrowExceptionWhenColumnsIsNull() { var template = new ImageCarouselTemplate(); ExceptionAssert.Throws <InvalidOperationException>("The columns cannot be null.", () => { ImageCarouselTemplate.Convert(template); }); }
public void ShouldConvertCustomICarouselTemplateToCarouselTemplate() { var template = new TestImageCarouselTemplate(); var imageCarouselTemplate = ImageCarouselTemplate.Convert(template); Assert.AreNotEqual(template, imageCarouselTemplate); var column = imageCarouselTemplate.Columns.First() as ImageCarouselColumn; Assert.AreEqual(new Uri("https://carousel.url"), column.ImageUrl); var action = column.Action as MessageAction; Assert.AreEqual("MessageLabel", action.Label); Assert.AreEqual("MessageText", action.Text); }