Example #1
0
            public void Returns_true_for_equal_objects()
            {
                Func <TransactionHandler> transactionHandlerFactory = () => new Mock <TransactionHandler>().Object;
                var resolver1 = new TransactionHandlerResolver(transactionHandlerFactory, "p", "s");
                var resolver2 = new TransactionHandlerResolver(transactionHandlerFactory, "p", "s");

                Assert.True(resolver1.Equals(resolver2));
            }
Example #2
0
            public void Returns_false_for_different_servers()
            {
                Func <TransactionHandler> transactionHandlerFactory = () => new Mock <TransactionHandler>().Object;
                var resolver1 = new TransactionHandlerResolver(transactionHandlerFactory, "p", "s");
                var resolver2 = new TransactionHandlerResolver(transactionHandlerFactory, "p", null);

                Assert.NotEqual(resolver1.GetHashCode(), resolver2.GetHashCode());
            }
Example #3
0
            public void Returns_same_values_for_equal_objects()
            {
                Func <TransactionHandler> transactionHandlerFactory = () => new Mock <TransactionHandler>().Object;
                var resolver1 = new TransactionHandlerResolver(transactionHandlerFactory, "p", "s");
                var resolver2 = new TransactionHandlerResolver(transactionHandlerFactory, "p", "s");

                Assert.Equal(resolver1.GetHashCode(), resolver2.GetHashCode());
            }
Example #4
0
            public void Returns_false_for_different_factories()
            {
                var resolver1 = new TransactionHandlerResolver(() => new Mock <TransactionHandler>().Object, "p", "s");
                var resolver2 = new TransactionHandlerResolver(() => new Mock <TransactionHandler>().Object, "p", "s");

                Assert.False(resolver1.Equals(resolver2));
                Assert.False(resolver2.Equals(resolver1));
            }
Example #5
0
            public void Returns_different_values_for_different_factories()
            {
                var resolver1 = new TransactionHandlerResolver(() => new Mock <TransactionHandler>().Object, "p", "s");
                var resolver2 = new TransactionHandlerResolver(
                    new Func <FakeTransactionHandler>(
                        () => new FakeTransactionHandler()), "p", "s");

                Assert.NotEqual(resolver1.GetHashCode(), resolver2.GetHashCode());
            }
Example #6
0
            public void Returns_false_for_different_providers()
            {
                Func <TransactionHandler> transactionHandlerFactory = () => new Mock <TransactionHandler>().Object;
                var resolver1 = new TransactionHandlerResolver(transactionHandlerFactory, "p", "s");
                var resolver2 = new TransactionHandlerResolver(transactionHandlerFactory, null, "s");

                Assert.False(resolver1.Equals(resolver2));
                Assert.False(resolver2.Equals(resolver1));
            }
Example #7
0
        /// <inheritdoc />
        public override bool Equals(object obj)
        {
            TransactionHandlerResolver transactionHandlerResolver = obj as TransactionHandlerResolver;

            if (transactionHandlerResolver == null || !(this._transactionHandlerFactory == transactionHandlerResolver._transactionHandlerFactory) || !(this._providerInvariantName == transactionHandlerResolver._providerInvariantName))
            {
                return(false);
            }
            return(this._serverName == transactionHandlerResolver._serverName);
        }
Example #8
0
            public void Returns_false_for_different_type()
            {
                var resolver = new TransactionHandlerResolver(() => new Mock <TransactionHandler>().Object, "p", "s");

                Assert.False(resolver.Equals(new object()));
            }
            public void Returns_different_values_for_different_factories()
            {
                var resolver1 = new TransactionHandlerResolver(() => new Mock<TransactionHandler>().Object, "p", "s");
                var resolver2 = new TransactionHandlerResolver(
                    new Func<FakeTransactionHandler>(
                        () => new FakeTransactionHandler()), "p", "s");

                Assert.NotEqual(resolver1.GetHashCode(), resolver2.GetHashCode());
            }
            public void Returns_false_for_different_servers()
            {
                Func<TransactionHandler> transactionHandlerFactory = () => new Mock<TransactionHandler>().Object;
                var resolver1 = new TransactionHandlerResolver(transactionHandlerFactory, "p", "s");
                var resolver2 = new TransactionHandlerResolver(transactionHandlerFactory, "p", null);

                Assert.NotEqual(resolver1.GetHashCode(), resolver2.GetHashCode());
            }
            public void Returns_same_values_for_equal_objects()
            {
                Func<TransactionHandler> transactionHandlerFactory = () => new Mock<TransactionHandler>().Object;
                var resolver1 = new TransactionHandlerResolver(transactionHandlerFactory, "p", "s");
                var resolver2 = new TransactionHandlerResolver(transactionHandlerFactory, "p", "s");

                Assert.Equal(resolver1.GetHashCode(), resolver2.GetHashCode());
            }
            public void Returns_false_for_different_providers()
            {
                Func<TransactionHandler> transactionHandlerFactory = () => new Mock<TransactionHandler>().Object;
                var resolver1 = new TransactionHandlerResolver(transactionHandlerFactory, "p", "s");
                var resolver2 = new TransactionHandlerResolver(transactionHandlerFactory, null, "s");

                Assert.False(resolver1.Equals(resolver2));
                Assert.False(resolver2.Equals(resolver1));
            }
            public void Returns_false_for_different_factories()
            {
                var resolver1 = new TransactionHandlerResolver(() => new Mock<TransactionHandler>().Object, "p", "s");
                var resolver2 = new TransactionHandlerResolver(() => new Mock<TransactionHandler>().Object, "p", "s");

                Assert.False(resolver1.Equals(resolver2));
                Assert.False(resolver2.Equals(resolver1));
            }
            public void Returns_false_for_different_type()
            {
                var resolver = new TransactionHandlerResolver(() => new Mock<TransactionHandler>().Object, "p", "s");

                Assert.False(resolver.Equals(new object()));
            }
            public void Returns_true_for_equal_objects()
            {
                Func<TransactionHandler> transactionHandlerFactory = () => new Mock<TransactionHandler>().Object;
                var resolver1 = new TransactionHandlerResolver(transactionHandlerFactory, "p", "s");
                var resolver2 = new TransactionHandlerResolver(transactionHandlerFactory, "p", "s");

                Assert.True(resolver1.Equals(resolver2));
            }