public void check_clone_copies_data() { var strValueTest = "Test String"; var strKeyTest = "Mykey"; var commentListTest = new List <string>(new string[] { "testComment 1", "testComment 2" }); //Create a key data KeyData kd2 = new KeyData(strKeyTest); kd2.Value = strValueTest; kd2.Comments = commentListTest; KeyData kd = kd2.Clone() as KeyData; //Assert not null and empty Assert.That(kd, Is.Not.Null); Assert.That(kd.KeyName, Is.EqualTo(strKeyTest)); Assert.That(kd.Value, Is.EqualTo(strValueTest)); Assert.That(kd.Comments, Has.Count.EqualTo(2)); Assert.That(kd.Comments[0], Is.EqualTo("testComment 1")); Assert.That(kd.Comments[1], Is.EqualTo("testComment 2")); kd.Value = "t"; Assert.That(kd2.Value, Is.EqualTo(strValueTest)); Assert.That(kd.Value, Is.EqualTo("t")); }
// ----- Methods ---------------------------------------------------- private object[] GenerateSerials(KeyData data, int amount) { var lst = new List <object>(); for (var i = 0; i < amount; i++) { var serial = _manager.GenerateSerial((KeyData)data.Clone()); lst.Add(serial); Debug.Print(serial); } return(lst.ToArray()); }