public void EqualityTest() { var money1 = new TestMoneyType(10, TestCurrencyEnum.Gel); var money2 = new TestMoneyType(10, TestCurrencyEnum.Gel); Assert.AreEqual(money1,money2); var command1 = new TestCommand(money1, "Georgial lari"); var command2 = new TestCommand(money2, "Georgial lari"); Assert.AreEqual(command1, command2); }
public void SerializeDeserializeTest() { var money1 = new TestMoneyType(10, TestCurrencyEnum.Gel); var command1 = new TestCommand(money1, "Georgial lari"); var formatter = new SoapFormatter(); Stream strem = new MemoryStream(); formatter.Serialize(strem, command1); strem.Seek(0, SeekOrigin.Begin); byte[] buf = new byte[strem.Length]; var s = strem.Read(buf, 0, (int)strem.Length); var command2 = formatter.Deserialize(strem).As<TestCommand>(); strem.Close(); Assert.AreEqual(command1, command2); }
public bool Equals(TestCommand other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other._money, _money) && Equals(other._name, _name); }