public void LoginUserProfileTest() { TestInfrastructure.DebugLineStart(TestContext); if (TestInfrastructure.IsActive(TestContext)) { using (IDictionary writeLM = TestInfrastructure.GetConnection(TestContext)) { ICard card = writeLM.Cards.AddNew(); ICardStyle style1 = card.CreateCardStyle(); style1.Answer.BackgroundColor = Color.Red; style1.Answer.FontFamily = new FontFamily("Arial"); ICardStyle style2 = style1.Clone(); //Check if style1 and style2 are equal Assert.AreEqual <Color>(style1.Answer.BackgroundColor, style2.Answer.BackgroundColor, "ICardStyle.Clone does not clone the original instance"); Assert.AreEqual <FontFamily>(style1.Answer.FontFamily, style2.Answer.FontFamily, "ICardStyle.Clone does not clone the original instance"); style2.Answer.BackgroundColor = Color.Blue; style2.Answer.FontFamily = new FontFamily("Courier New"); //Check if style 1 and style2 are independent Assert.AreNotEqual <Color>(style1.Answer.BackgroundColor, style2.Answer.BackgroundColor, "ICardStyle.Clone does not make an independent copy of the original instance"); Assert.AreNotEqual <FontFamily>(style1.Answer.FontFamily, style2.Answer.FontFamily, "ICardStyle.Clone does not make an independent copy of the original instance"); } } TestInfrastructure.DebugLineEnd(TestContext); }
/// <summary> /// Edits the card style. /// </summary> /// <remarks>Documented by Dev05, 2007-10-31</remarks> protected override void EditCardStyle() { if (Multiselect) { ICard card = Dictionary.Cards.GetCardByID(cards[0]).BaseCard; if (card.Settings.Style == null) { card.Settings.Style = card.CreateCardStyle(); } CardStyleEditor editor = new CardStyleEditor(); editor.HelpNamespace = this.HelpNamespace; editor.LoadStyle(card, card.Settings.Style, Dictionary, card); switch (editor.ShowDialog()) { case DialogResult.Abort: foreach (int id in cards) { Dictionary.Cards.GetCardByID(id).BaseCard.Settings.Style = null; } break; case DialogResult.OK: default: foreach (int id in cards) { Dictionary.Cards.GetCardByID(id).BaseCard.Settings.Style = card.Settings.Style; } break; } } else { base.EditCardStyle(); } }