public void ShouldNotThrowExceptionWhenValueIsTel() { var action = new UriAction { Url = new Uri("tel://1234") }; }
public void Url_Tel_ThrowsNoException() { UriAction action = new UriAction() { Url = new Uri("tel://1234") }; }
public void ShouldNotThrowExceptionWhenValueIsLine() { var action = new UriAction { Url = new Uri("line://nv/camera/") }; }
public void ShouldNotThrowExceptionWhenValueIsHttps() { var action = new UriAction { Url = new Uri("https://foo.bar") }; }
public void Convert_TemplateMessageWithCustomIConfirmTemplate_ConvertedToConfirmTemplate() { TestTemplateMessage message = new TestTemplateMessage() { Template = new TestConfirmTemplate() }; ISendMessage[] messages = MessageConverter.Convert(new ISendMessage[] { message }); Assert.AreEqual(1, messages.Length); Assert.AreNotEqual(message, messages[0]); TemplateMessage templateMessage = messages[0] as TemplateMessage; Assert.AreEqual("AlternativeText", templateMessage.AlternativeText); ConfirmTemplate template = templateMessage.Template as ConfirmTemplate; Assert.AreEqual("ConfirmText", template.Text); MessageAction okAction = template.OkAction as MessageAction; Assert.AreEqual("MessageLabel", okAction.Label); Assert.AreEqual("MessageText", okAction.Text); UriAction cancelAction = template.CancelAction as UriAction; Assert.AreEqual("UriLabel", cancelAction.Label); Assert.AreEqual(new Uri("tel://uri"), cancelAction.Url); }
public static void AddLinkToWebLink() { PdfFile pdfFile = new PdfFile(); PdfDocument document = pdfFile.Import(File.ReadAllBytes("sample.pdf")); PdfPage page = document.Pages[0]; PageContentBuilder builder = new PageContentBuilder(page); builder.GraphicState.FillColor = new RgbColor(100, 255, 0, 0); //Add external hyperlink with Action UriAction uriAction = new UriAction(); uriAction.Uri = new Uri("http://www.iditect.com"); Rect rectArea = new Rect(50, 150, 100, 100); var uriLink = page.Annotations.AddLink(uriAction); uriLink.Rect = rectArea; builder.DrawRectangle(rectArea); //Add external hyperlink with Block Block block = new Block(); block.InsertText("This is a "); block.GraphicState.FillColor = new RgbColor(0, 0, 255); block.InsertHyperlinkStart(new Uri("http://www.iditect.com")); block.InsertText("hyperlink"); block.InsertHyperlinkEnd(); builder.Position.Translate(50, 300); builder.DrawBlock(block); File.WriteAllBytes("AddLink2.pdf", pdfFile.Export(document)); }
public void ShouldThrowExceptionWhenValueIsNotHttpOrHttpsOrTel() { var action = new UriAction(); ExceptionAssert.Throws <InvalidOperationException>("The url should use the http, https or tel scheme.", () => { action.Url = new Uri("ftp://foo.bar"); }); }
public void ShouldThrowExceptionWhenValueIsNull() { var action = new UriAction(); ExceptionAssert.Throws <InvalidOperationException>("The url cannot be null.", () => { action.Url = null; }); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); AudioBox.ItemsSource = AudioList; if ((int)localSettings.Values[Settings.ACTIONACTION] == Settings.Actions.CREATE) { return; } using (var context = new TaskSchedulerDbContext()) { Models.Action action = context.Actions.Where(x => x.Id == (int)localSettings.Values[Settings.ACTIONID]).First(); switch (action.Type) { case ActionType.URI: { UriAction uriAction = context.UriActions.Where(x => x.Id == action.ActionId).First(); Uri = uriAction.Uri; Index = 0; }; break; case ActionType.NOTIFICATION: { NotificationAction notificationAction = context.NotificationActions.Where(x => x.Id == action.ActionId).First(); Text = notificationAction.Text; Image = notificationAction.Image; Audio = notificationAction.Audio.GetValueOrDefault(0); if (notificationAction.Timeout.HasValue) { Timeout = notificationAction.Timeout.Value.ToString(); } Index = 1; }; break; case ActionType.APPLICATION: { ApplicationAction applicationAction = context.ApplicationActions.Where(x => x.Id == action.ActionId).First(); appListProvider.IsDoneTask.ContinueWith(async(result) => { await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { bool ok = appListProvider.AppList.Where(x => x.Package.Id.FullName == applicationAction.ApplicationName).Any(); if (ok) { AppEntry entry = appListProvider.AppList.Where(x => x.Package.Id.FullName == applicationAction.ApplicationName).First(); LoadedContent.SelectedItem = entry; LoadedContent.ScrollIntoView(entry); } }); }); Index = 2; }; break; } } }
public void Label_Empty_ThrowsException() { UriAction action = new UriAction(); ExceptionAssert.Throws <InvalidOperationException>("The label cannot be null or whitespace.", () => { action.Label = string.Empty; }); }
public void Url_NotHttpOrHttpsOrTel_ThrowsException() { UriAction action = new UriAction(); ExceptionAssert.Throws <InvalidOperationException>("The url should use the http, https or tel scheme.", () => { action.Url = new Uri("ftp://foo.bar"); }); }
public void ShouldThrowExceptionWhenValueIsMoreThan20Chars() { var action = new UriAction(); ExceptionAssert.Throws <InvalidOperationException>("The label cannot be longer than 20 characters.", () => { action.Label = new string('x', 21); }); }
public void Url_MoreThan1000Chars_ThrowsException() { UriAction action = new UriAction(); ExceptionAssert.Throws <InvalidOperationException>("The url cannot be longer than 1000 characters.", () => { action.Url = new Uri("https://foo.bar/" + new string('x', 985)); }); }
public void Url_Null_ThrowsException() { UriAction action = new UriAction(); ExceptionAssert.Throws <InvalidOperationException>("The url cannot be null.", () => { action.Url = null; }); }
public void Label_MoreThan20Chars_ThrowsException() { UriAction action = new UriAction(); ExceptionAssert.Throws <InvalidOperationException>("The label cannot be longer than 20 characters.", () => { action.Label = new string('x', 21); }); }
public void ShouldThrowExceptionWhenValueIsEmpty() { var action = new UriAction(); ExceptionAssert.Throws <InvalidOperationException>("The label cannot be null or whitespace.", () => { action.Label = string.Empty; }); }
public void ShouldNotThrowExceptionWhenValid() { IAction action = new UriAction() { Url = new Uri("https://foo.bar"), Label = "UriLabel" }; action.Validate(); }
public void ShouldNotThrowExceptionWhenValueIs1000Chars() { var value = new Uri("http://foo.bar/" + new string('x', 984)); var action = new UriAction() { Url = value }; Assert.AreEqual(value, action.Url); }
public void Label_20Chars_ThrowsNoException() { string value = new string('x', 20); UriAction action = new UriAction() { Label = value }; Assert.AreEqual(value, action.Label); }
public void ShouldNotThrowExceptionWhenValueIs20Chars() { var value = new string('x', 20); var action = new UriAction() { Label = value }; Assert.AreEqual(value, action.Label); }
public void Url_1000Chars_ThrowsNoException() { Uri value = new Uri("http://foo.bar/" + new string('x', 984)); UriAction action = new UriAction() { Url = value }; Assert.AreEqual(value, action.Url); }
public void ShouldConvertCustomIUriActioneToUriAction() { var action = new TestUriAction(); var uriAction = UriAction.Convert(action); Assert.AreNotEqual(action, uriAction); Assert.AreEqual("UriLabel", uriAction.Label); Assert.AreEqual("tel://uri/", uriAction.Url.ToString()); }
public void ShouldCreateSerializeableObject() { var action = new UriAction { Label = "Foo", Url = new Uri("http://foo.bar") }; string serialized = JsonConvert.SerializeObject(action); Assert.AreEqual(@"{""type"":""uri"",""label"":""Foo"",""uri"":""http://foo.bar""}", serialized); }
public void Constructor_SerializedCorrectly() { UriAction action = new UriAction { Label = "Foo", Url = new Uri("http://foo.bar") }; string serialized = JsonConvert.SerializeObject(action); Assert.AreEqual(@"{""type"":""uri"",""label"":""Foo"",""uri"":""http://foo.bar""}", serialized); }
public void ShouldThrowExceptionWhenUriIsNull() { IAction action = new UriAction() { Label = "UriLabel" }; ExceptionAssert.Throws <InvalidOperationException>("The url cannot be null.", () => { action.Validate(); }); }
public void ShouldThrowExceptionWhenUriIsNull() { var action = new UriAction() { Label = "UriLabel" }; ExceptionAssert.Throws <InvalidOperationException>("The url cannot be null.", () => { UriAction.Convert(action); }); }
public void ShouldThrowExceptionWhenLabelIsNull() { var action = new UriAction() { Url = new Uri("https://foo.bar") }; ExceptionAssert.Throws <InvalidOperationException>("The label cannot be null.", () => { UriAction.Convert(action); }); }
public void ShouldNotThrowExceptionWhenValueIsNotNull() { var action = new UriAction { Label = "testLabel2", Url = new Uri("http://www.bing.com") }; var richMenuArea = new RichMenuArea { Action = action }; Assert.AreEqual(action, richMenuArea.Action); }
public void ShouldNotThrowExceptionWhenValueIsNotNull() { var action = new UriAction { Label = "testLabel2", Url = new Uri("http://www.bing.com") }; var confirmTemplate = new ConfirmTemplate { OkAction = action }; Assert.AreEqual(action, confirmTemplate.OkAction); }
private void CreateAction(RadFixedPage firstPage, Location location) { #region radpdfprocessing-model-annotations-and-destinations_3 GoToAction goToAction = new GoToAction(); goToAction.Destination = location; var goToLink = firstPage.Annotations.AddLink(goToAction); goToLink.Rect = new Rect(10, 10, 50, 50); UriAction uriAction = new UriAction(); uriAction.Uri = new Uri(@"http://www.telerik.com"); var uriLink = firstPage.Annotations.AddLink(uriAction); uriLink.Rect = new Rect(70, 10, 50, 50); #endregion }