Example #1
0
        public void EqualityTest()
        {
            var obj1 = new GameAction()
            {
                AdditionalArguments = "addargs",
                Arguments           = "args",
                EmulatorId          = new Guid(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
                EmulatorProfileId   = new Guid(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
                IsHandledByPlugin   = false,
                Name = "name",
                OverrideDefaultArgs = false,
                Path = "path",
                SuppressNotifications = false,
                Type       = GameActionType.Emulator,
                WorkingDir = "workdir"
            };

            var obj2 = new GameAction()
            {
                AdditionalArguments = "addargs",
                Arguments           = "args",
                EmulatorId          = new Guid(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
                EmulatorProfileId   = new Guid(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
                IsHandledByPlugin   = false,
                Name = "name",
                OverrideDefaultArgs = false,
                Path = "path",
                SuppressNotifications = false,
                Type       = GameActionType.Emulator,
                WorkingDir = "workdir"
            };

            var obj3 = new GameAction()
            {
                AdditionalArguments = "addargs2",
                Arguments           = "args2",
                EmulatorId          = new Guid(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
                EmulatorProfileId   = new Guid(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
                IsHandledByPlugin   = true,
                Name = "name2",
                OverrideDefaultArgs = true,
                Path = "path2",
                SuppressNotifications = true,
                Type       = GameActionType.File,
                WorkingDir = "workdir2"
            };

            Assert.IsTrue(obj1.Equals(obj2));
            Assert.AreEqual(obj1.GetHashCode(), obj2.GetHashCode());

            Assert.IsFalse(obj1.Equals(obj3));
            Assert.AreNotEqual(obj1.GetHashCode(), obj3.GetHashCode());
        }
Example #2
0
        public void EqualityTest()
        {
            var obj1 = new GameAction()
            {
                AdditionalArguments = "addargs",
                Arguments           = "args",
                EmulatorId          = new Guid(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
                EmulatorProfileId   = "2",
                IsPlayAction        = false,
                Name = "name",
                OverrideDefaultArgs = false,
                Path = "path",
                SuppressNotifications = false,
                Type       = GameActionType.Emulator,
                WorkingDir = "workdir"
            };

            var obj2 = new GameAction()
            {
                AdditionalArguments = "addargs",
                Arguments           = "args",
                EmulatorId          = new Guid(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
                EmulatorProfileId   = "2",
                IsPlayAction        = false,
                Name = "name",
                OverrideDefaultArgs = false,
                Path = "path",
                SuppressNotifications = false,
                Type       = GameActionType.Emulator,
                WorkingDir = "workdir"
            };

            var obj3 = new GameAction()
            {
                AdditionalArguments = "addargs2",
                Arguments           = "args2",
                EmulatorId          = new Guid(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
                EmulatorProfileId   = "1",
                IsPlayAction        = true,
                Name = "name2",
                OverrideDefaultArgs = true,
                Path = "path2",
                SuppressNotifications = true,
                Type       = GameActionType.File,
                WorkingDir = "workdir2"
            };

            Assert.IsTrue(obj1.Equals(obj2));
            Assert.IsFalse(obj1.Equals(obj3));

            Assert.IsTrue(
                new List <GameAction> {
                new GameAction()
                {
                    Name = "1"
                }, new GameAction()
                {
                    Name = "2"
                }
            }.IsListEqualExact(
                    new List <GameAction> {
                new GameAction()
                {
                    Name = "1"
                }, new GameAction()
                {
                    Name = "2"
                }
            }));

            Assert.IsFalse(
                new List <GameAction> {
                new GameAction()
                {
                    Name = "1"
                }, new GameAction()
                {
                    Name = "2"
                }
            }.IsListEqualExact(
                    new List <GameAction> {
                new GameAction()
                {
                    Name = "2"
                }, new GameAction()
                {
                    Name = "1"
                }
            }));
        }
        public void Equals_OtherInstance_IsTrue()
        {
            object other = GameAction.Raise(17);

            Assert.IsTrue(TestInstance.Equals(other));
        }