public void exhibit_should_allow_two_content_items_adding() { var contentItemImage = new ContentItem { Title = "ContentItemImage", MediaType = "Image", Uri = "http://i.telegraph.co.uk/multimedia/archive/02429/eleanor_scriven_2429776k.jpg" }; var contentItemMusic = new ContentItem { Title = "ContentItemMusic", MediaType = "Audio", Uri = "http://libsyn.com/media/eslpod/ESLPod900.mp3" }; var exhibit = new Exhibit { Title = "WebdriverExhibitWithContent", ContentItems = new Collection<Chronozoom.Entities.ContentItem> { contentItemImage, contentItemMusic } }; ExhibitHelper.AddExhibitWithContentItem(exhibit); _newExhibit = ExhibitHelper.GetNewExhibit(); Assert.AreEqual(exhibit.ContentItems.Count, _newExhibit.ContentItems.Count, "Content items count are not equal"); for (int i = 0; i < exhibit.ContentItems.Count; i++) { Assert.AreEqual(exhibit.ContentItems[i].Title, _newExhibit.ContentItems[i].Title, "Content items titles are not equal"); Assert.AreEqual(exhibit.ContentItems[i].MediaType, _newExhibit.ContentItems[i].MediaType, true, "Content items mediaTypes are not equal"); Assert.AreEqual(exhibit.ContentItems[i].Uri, _newExhibit.ContentItems[i].Uri, "Content items Uri are not equal"); } }
public void exhibit_should_allow_pdf_content_item_adding() { Logger.Log("Bug: https://github.com/alterm4nn/ChronoZoom/issues/526", LogType.Debug); var contentItemPdf = new ContentItem { Title = "ContentItemPdf", Caption = "This is pdf", MediaSource = "http://ads.ccsd.cnrs.fr/docs/00/10/47/81/PDF/p85_89_vol3483m.pdf", MediaType = "PDF", Attribution = "Tests Attribution", Uri = "http://ads.ccsd.cnrs.fr/docs/00/10/47/81/PDF/p85_89_vol3483m.pdf" }; var exhibit = new Exhibit { Title = "WebdriverExhibitWithContent", ContentItems = new Collection<Chronozoom.Entities.ContentItem> { contentItemPdf } }; ExhibitHelper.AddExhibitWithContentItem(exhibit); _newExhibit = ExhibitHelper.GetNewExhibit(); Assert.AreEqual(exhibit.ContentItems.Count, _newExhibit.ContentItems.Count, "Content items count are not equal"); for (int i = 0; i < exhibit.ContentItems.Count; i++) { Assert.AreEqual(exhibit.ContentItems[i].Title, _newExhibit.ContentItems[i].Title, "Content items titles are not equal"); Assert.AreEqual(exhibit.ContentItems[i].MediaType, _newExhibit.ContentItems[i].MediaType, true, "Content items mediaTypes are not equal"); Assert.AreEqual(exhibit.ContentItems[i].Uri, _newExhibit.ContentItems[i].Uri, "Content items Uri are not equal"); } }
public void exhibit_should_allow_skydrive_content_item_adding() { var contentDocumentItemSkyDrive = new ContentItem { Title = "ContentItemSkyDrive", Caption = "This is skydrive", SkyDriveFileType = ContentItem.SkyDriveType.Document, Attribution = "Tests Attribution", FileName = "test document" }; var contentPictureItemSkyDrive = new ContentItem { Title = "ContentItemSkyDrive", Caption = "This is skydrive", SkyDriveFileType = ContentItem.SkyDriveType.Image, Attribution = "Tests Attribution", FileName = "panda" }; var exhibit = new Exhibit { Title = "WebdriverExhibitWithContent", ContentItems = new Collection<Chronozoom.Entities.ContentItem> { contentDocumentItemSkyDrive, contentPictureItemSkyDrive } }; ExhibitHelper.AddExhibitWithSkyDriveContentItem(exhibit); _newExhibit = ExhibitHelper.GetNewExhibit(); Assert.AreEqual(exhibit.ContentItems.Count, _newExhibit.ContentItems.Count, "Content items count are not equal"); for (int i = 0; i < exhibit.ContentItems.Count; i++) { Assert.AreEqual(exhibit.ContentItems[i].Title, _newExhibit.ContentItems[i].Title, "Content items titles are not equal"); } }
public Exhibit GetNewExhibit() { Logger.Log("<-"); const string script = Javascripts.LastCanvasElement; var exhibit = new Exhibit(); var contentItem = new ContentItem(); exhibit.ContentItems = new Collection<Chronozoom.Entities.ContentItem>(); exhibit.Title = GetJavaScriptExecutionResult(script + ".title"); int contentItemsCount = int.Parse(GetJavaScriptExecutionResult(script + ".contentItems.length")); Logger.Log("- contentItemsCount: " + contentItemsCount); for (int i = 0; i < contentItemsCount; i++) { string item = string.Format("{0}.contentItems[{1}].", script, i); contentItem.Title = GetJavaScriptExecutionResult(item + "title"); Logger.Log("- contentItem.Title: " + contentItem.Title); contentItem.Caption = GetJavaScriptExecutionResult(item + "description"); Logger.Log("- contentItem.Caption: " + contentItem.Caption); contentItem.Uri = GetJavaScriptExecutionResult(item + "uri"); Logger.Log("- contentItem.MediaSource: " + contentItem.MediaSource); contentItem.MediaType = GetJavaScriptExecutionResult(item + "mediaType"); Logger.Log("- contentItem.MediaType: " + contentItem.MediaType); contentItem.MediaSource = GetJavaScriptExecutionResult(item + "mediaSource"); Logger.Log("- contentItem.MediaSource: " + contentItem.MediaSource); contentItem.Attribution = GetJavaScriptExecutionResult(item + "attribution"); Logger.Log("- contentItem.attribution: " + contentItem.Attribution); exhibit.ContentItems.Add(contentItem); } exhibit.Id = new Guid(GetJavaScriptExecutionResult(script + ".guid")); Logger.Log("- exhibit.Id: " + exhibit.Id); Logger.Log("->" + exhibit); return exhibit; }
public Exhibit GetNewExhibit() { Logger.Log("<-"); var exhibit = new Exhibit { ContentItems = new Collection<Chronozoom.Entities.ContentItem>(), Title = GetJavaScriptExecutionResult(LastCanvasElement + ".title"), Year = GetNewExhibitYear(), Month = GetNewExhibitMonth(), Day = GetNewExhibitday() }; int contentItemsCount = int.Parse(GetJavaScriptExecutionResult(LastCanvasElement + ".contentItems.length")); Logger.Log("- contentItemsCount: " + contentItemsCount, LogType.MessageWithoutScreenshot); for (int i = 0; i < contentItemsCount; i++) { var contentItem = new ContentItem(); string item = string.Format("{0}.contentItems[{1}].", LastCanvasElement, i); contentItem.Title = GetJavaScriptExecutionResult(item + "title"); Logger.Log("- contentItem.Title: " + contentItem.Title, LogType.MessageWithoutScreenshot); contentItem.Caption = GetJavaScriptExecutionResult(item + "description"); Logger.Log("- contentItem.Caption: " + contentItem.Caption, LogType.MessageWithoutScreenshot); contentItem.Uri = GetJavaScriptExecutionResult(item + "uri"); Logger.Log("- contentItem.Uri: " + contentItem.Uri, LogType.MessageWithoutScreenshot); contentItem.MediaType = GetJavaScriptExecutionResult(item + "mediaType"); Logger.Log("- contentItem.MediaType: " + contentItem.MediaType, LogType.MessageWithoutScreenshot); contentItem.MediaSource = GetJavaScriptExecutionResult(item + "mediaSource"); Logger.Log("- contentItem.MediaSource: " + contentItem.MediaSource, LogType.MessageWithoutScreenshot); contentItem.Attribution = GetJavaScriptExecutionResult(item + "attribution"); Logger.Log("- contentItem.Attribution: " + contentItem.Attribution, LogType.MessageWithoutScreenshot); exhibit.ContentItems.Add(contentItem); } WaitCondition(() => (GetJavaScriptExecutionResult(LastCanvasElement + ".guid") != string.Empty), Configuration.ImplicitWait); string parseGuid = GetJavaScriptExecutionResult(LastCanvasElement + ".guid"); Logger.Log("- parse guid: " + parseGuid, LogType.MessageWithoutScreenshot); exhibit.Id = new Guid(parseGuid); Logger.Log("- exhibit.Id: " + exhibit.Id, LogType.MessageWithoutScreenshot); Logger.Log("->" + exhibit); return exhibit; }
private void FillArtifact(ContentItem contentItem) { Logger.Log("<- contentItem: " + contentItem); if (contentItem.Title != null) SetTitle(contentItem.Title); if (contentItem.Caption != null) SetDescription(contentItem.Caption); if (contentItem.Uri != null) SetUrl(contentItem.Uri); if (contentItem.MediaType != null) SelectMediaType(contentItem.MediaType); if (contentItem.Attribution != null) SetAttribution(contentItem.Attribution); if (contentItem.MediaSource != null) SetMediaSourse(contentItem.MediaSource); Logger.Log("->"); }