Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 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);
 }