public void SocialActivity_Constructor_With_All_Parameters_Sets_Correct_Properties() { var activity = new SocialActivity("action", "network", "target"); Assert.AreEqual("network", activity.Network); Assert.AreEqual("action", activity.Action); Assert.AreEqual("target", activity.Target); }
private static string GetEndingYear(SocialActivity data, string language) { if (data.EndingYear.HasValue && data.EndingYear > 0) { return(data.EndingYear.Value.ToString()); } return(DocumentMetadataTexts.GetText(MetadataTexts.CV_PRESENT, language)); }
public void UrchinActivityParameterBuilder_GetParameter_For_SocialActivity_Returns_Correct_Optional_Values() { var activity = new SocialActivity("action", "network", pagePath: "pagePath", target: "target"); var parameters = UrchinActivityParameterBuilder.GetParameters(activity).ToDictionary(k => k.Key, v => v.Value); Assert.AreEqual("target", parameters["utmsid"]); Assert.AreEqual("pagePath", parameters["utmp"]); }
public void UrchinActivityParameterBuilder_GetParameter_For_SocialActivity_Returns_Correct_Utmt_Type() { var activity = new SocialActivity("action", "category"); var results = UrchinActivityParameterBuilder.GetParameters(activity).ToDictionary(k => k.Key, v => v); CollectionAssert.Contains(results.Keys, "utmt"); Assert.AreEqual("social", results["utmt"].Value); }
public void UrchinActivityParameterBuilder_GetParameter_For_SocialActivity_Returns_Correct_Values() { var activity = new SocialActivity("action", "network"); var parameters = UrchinActivityParameterBuilder.GetParameters(activity).ToDictionary(k => k.Key, v => v.Value); Assert.AreEqual("network", parameters["utmsn"]); Assert.AreEqual("action", parameters["utmsa"]); }
public void UrchinActivityParameterBuilder_GetParameter_For_SocialActivity_Returns_Correct_Keys() { var activity = new SocialActivity("action", "network", pagePath: "pagePath", target: "target"); var actualKeys = UrchinActivityParameterBuilder.GetParameters(activity).Select(k => k.Key).ToArray(); var expectedKeys = new[] { "utmsn", "utmsa", "utmsid", "utmp", "utmt" }; CollectionAssert.AreEquivalent(expectedKeys, actualKeys); }
/// <summary> /// Obtain the key/value pairs for a SocialActivity. /// </summary> /// <param name="social">SocialActivity to turn into key/value pairs.</param> /// <returns>Key/value pairs representing this SocialActivity.</returns> internal static IEnumerable <KeyValuePair <string, string> > GetParameters(SocialActivity social) { yield return(KeyValuePair.Create("t", "social")); yield return(KeyValuePair.Create("sn", social.Network)); yield return(KeyValuePair.Create("sa", social.Action)); yield return(KeyValuePair.Create("st", social.Target)); }
public void SocialActivity_Constructor_With_Minimal_Parameters_Sets_Correct_Properties() { var activity = new SocialActivity("action", "network"); Assert.AreEqual("network", activity.Network); Assert.AreEqual("action", activity.Action); Assert.IsNull(activity.Target); Assert.IsNull(activity.PagePath); }
public void MeasurementActivityParameterBuilder_GetParameter_For_SocialActivity_Returns_Correct_Values() { var activity = new SocialActivity("action", "network", target: "target"); var parameters = MeasurementActivityParameterBuilder.GetParameters(activity).ToDictionary(k => k.Key, v => v.Value); Assert.AreEqual(4, parameters.Keys.Count); Assert.AreEqual("social", parameters["t"]); Assert.AreEqual("network", parameters["sn"]); Assert.AreEqual("action", parameters["sa"]); Assert.AreEqual("target", parameters["st"]); }
/// <summary> /// Obtain the key/value pairs for a SocialActivity. /// </summary> /// <param name="social">SocialActivity to turn into key/value pairs.</param> /// <returns>Key/value pairs representing this SocialActivity.</returns> internal static IEnumerable <KeyValuePair <string, string> > GetParameters(SocialActivity social) { yield return(KeyValuePair.Create("utmt", "social")); yield return(KeyValuePair.Create("utmsa", social.Action)); yield return(KeyValuePair.Create("utmsn", social.Network)); if (!String.IsNullOrWhiteSpace(social.Target)) { yield return(KeyValuePair.Create("utmsid", social.Target)); } if (!String.IsNullOrWhiteSpace(social.PagePath)) { yield return(KeyValuePair.Create("utmp", social.PagePath)); } }
private static TableRow CreateMembershipRow(SocialActivity data, string language) { TableRow tableRow2 = new TableRow() { RsidTableRowAddition = "009B2C1D", RsidTableRowProperties = "009E39C2", ParagraphId = "533821CC", TextId = "77777777" }; TableCell tableCell2 = new TableCell(); TableCellProperties tableCellProperties2 = new TableCellProperties(); TableCellWidth tableCellWidth2 = new TableCellWidth() { Width = "2550", Type = TableWidthUnitValues.Dxa }; TableCellBorders tableCellBorders2 = new TableCellBorders(); TopBorder topBorder3 = new TopBorder() { Val = BorderValues.Single, Color = "FFFFFF", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; LeftBorder leftBorder3 = new LeftBorder() { Val = BorderValues.Single, Color = "FFFFFF", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; BottomBorder bottomBorder3 = new BottomBorder() { Val = BorderValues.Single, Color = "FFFFFF", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; RightBorder rightBorder3 = new RightBorder() { Val = BorderValues.Single, Color = "FFFFFF", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; tableCellBorders2.Append(topBorder3); tableCellBorders2.Append(leftBorder3); tableCellBorders2.Append(bottomBorder3); tableCellBorders2.Append(rightBorder3); tableCellProperties2.Append(tableCellWidth2); tableCellProperties2.Append(tableCellBorders2); Paragraph paragraph2 = new Paragraph() { RsidParagraphAddition = "009B2C1D", RsidRunAdditionDefault = "009E39C2", ParagraphId = "6899F9F0", TextId = "77777777" }; Run run3 = new Run(); RunProperties runProperties3 = new RunProperties(); FontSize fontSize3 = new FontSize() { Val = "22" }; FontSizeComplexScript fontSizeComplexScript3 = new FontSizeComplexScript() { Val = "22" }; runProperties3.Append(fontSize3); runProperties3.Append(fontSizeComplexScript3); Text text3 = new Text() { Space = SpaceProcessingModeValues.Preserve }; text3.Text = $" {data.StartingYear} - {GetEndingYear(data, language)} "; run3.Append(runProperties3); run3.Append(text3); paragraph2.Append(run3); tableCell2.Append(tableCellProperties2); tableCell2.Append(paragraph2); TableCell tableCell3 = new TableCell(); TableCellProperties tableCellProperties3 = new TableCellProperties(); TableCellWidth tableCellWidth3 = new TableCellWidth() { Width = "6239", Type = TableWidthUnitValues.Dxa }; GridSpan gridSpan2 = new GridSpan() { Val = 2 }; TableCellBorders tableCellBorders3 = new TableCellBorders(); TopBorder topBorder4 = new TopBorder() { Val = BorderValues.Single, Color = "FFFFFF", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; LeftBorder leftBorder4 = new LeftBorder() { Val = BorderValues.Single, Color = "000000", Size = (UInt32Value)1U, Space = (UInt32Value)0U }; BottomBorder bottomBorder4 = new BottomBorder() { Val = BorderValues.Single, Color = "FFFFFF", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; RightBorder rightBorder4 = new RightBorder() { Val = BorderValues.Single, Color = "FFFFFF", Size = (UInt32Value)0U, Space = (UInt32Value)0U }; tableCellBorders3.Append(topBorder4); tableCellBorders3.Append(leftBorder4); tableCellBorders3.Append(bottomBorder4); tableCellBorders3.Append(rightBorder4); tableCellProperties3.Append(tableCellWidth3); tableCellProperties3.Append(gridSpan2); tableCellProperties3.Append(tableCellBorders3); Paragraph paragraph3 = new Paragraph() { RsidParagraphAddition = "009E39C2", RsidParagraphProperties = "009E39C2", RsidRunAdditionDefault = "009E39C2", ParagraphId = "72BA0AEC", TextId = "77777777" }; ParagraphProperties paragraphProperties1 = new ParagraphProperties(); SpacingBetweenLines spacingBetweenLines1 = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto }; Indentation indentation1 = new Indentation() { Left = "271", Hanging = "127" }; ParagraphMarkRunProperties paragraphMarkRunProperties1 = new ParagraphMarkRunProperties(); FontSize fontSize4 = new FontSize() { Val = "21" }; FontSizeComplexScript fontSizeComplexScript4 = new FontSizeComplexScript() { Val = "21" }; paragraphMarkRunProperties1.Append(fontSize4); paragraphMarkRunProperties1.Append(fontSizeComplexScript4); paragraphProperties1.Append(spacingBetweenLines1); paragraphProperties1.Append(indentation1); paragraphProperties1.Append(paragraphMarkRunProperties1); Run run4 = new Run(); RunProperties runProperties4 = new RunProperties(); FontSize fontSize5 = new FontSize() { Val = "21" }; FontSizeComplexScript fontSizeComplexScript5 = new FontSizeComplexScript() { Val = "21" }; runProperties4.Append(fontSize5); runProperties4.Append(fontSizeComplexScript5); Text text4 = new Text(); text4.Text = data.Description; run4.Append(runProperties4); run4.Append(text4); paragraph3.Append(paragraphProperties1); paragraph3.Append(run4); tableCell3.Append(tableCellProperties3); tableCell3.Append(paragraph3); tableRow2.Append(tableCell2); tableRow2.Append(tableCell3); return(tableRow2); }