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 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.º 3
0
 public bool Equals(TestMoneyType other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(other._amount == _amount && Equals(other._currency, _currency));
 }
Exemplo n.º 4
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.º 5
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.º 6
0
 public TestCommand(TestMoneyType money, string name)
 {
     _money = money;
     _name  = name;
 }
Exemplo n.º 7
0
 public TestCommand(TestMoneyType money, string name)
 {
     _money = money;
     _name = name;
 }
Exemplo n.º 8
0
 public bool Equals(TestMoneyType other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return other._amount == _amount && Equals(other._currency, _currency);
 }