Esempio n. 1
0
        public void MsgArgEquals()
        {
            AllJoyn.MsgArg arg1 = new AllJoyn.MsgArg();
            AllJoyn.MsgArg arg2 = new AllJoyn.MsgArg();
            AllJoyn.MsgArg arg3 = new AllJoyn.MsgArg();
            arg1 = "Yo";
            arg2 = "Yo";
            arg3 = 42;
            object arg4;

            Assert.True(arg1 == arg2);
            Assert.False(arg1 != arg2);
            Assert.True(arg1 != arg3);
            Assert.False(arg1 == arg3);

            Assert.True(arg1.Equals(arg2));
            Assert.False(arg1.Equals(arg3));

            Assert.False(arg1.Equals((object)null));
            arg4 = 42; //not a MsgArg;
            Assert.False(arg1.Equals(arg4));
            arg4 = arg2;
            Assert.True(arg1.Equals(arg4));

            Assert.Equal(arg1.GetHashCode(), arg2.GetHashCode());
            Assert.NotEqual(arg1.GetHashCode(), arg3.GetHashCode());
        }