public void ShouldThrowExceptionWhenCancelActionIsNull() { var template = new ConfirmTemplate() { Text = "ConfirmText", OkAction = new MessageAction() }; ExceptionAssert.Throws <InvalidOperationException>("The cancel action cannot be null.", () => { ConfirmTemplate.Convert(template); }); }
public void ShouldConvertCustomIConfirmTemplateToConfirmTemplate() { var template = new TestConfirmTemplate(); var confirmTemplate = ConfirmTemplate.Convert(template); Assert.AreEqual("ConfirmText", template.Text); var okAction = confirmTemplate.OkAction as MessageAction; Assert.AreEqual("MessageLabel", okAction.Label); Assert.AreEqual("MessageText", okAction.Text); var cancelAction = confirmTemplate.CancelAction as UriAction; Assert.AreEqual("UriLabel", cancelAction.Label); Assert.AreEqual(new Uri("tel://uri"), cancelAction.Url); }
public void ShouldPreserveInstanceWhenValueIsCarouselTemplate() { var template = new ConfirmTemplate() { Text = "ConfirmText", OkAction = new MessageAction() { Label = "PostbackLabel", Text = "PostbackText" }, CancelAction = new UriAction() { Label = "PostbackLabel", Url = new Uri("http://foo.bar") } }; var confirmTemplate = ConfirmTemplate.Convert(template); Assert.AreSame(template, confirmTemplate); Assert.AreSame(confirmTemplate.OkAction, template.OkAction); Assert.AreSame(confirmTemplate.CancelAction, template.CancelAction); }