public void Two_tasks_with_same_entity_should_be_equal()
        {
            var p1 = new Product { Id = 1 };

            var task1 = new ProductUpdateTask(p1);
            var task2 = new ProductUpdateTask(p1);

            Assert.AreEqual(task1, task2);
        }
        public void Two_different_task_types_with_same_entity_should_not_be_equal()
        {
            var p1 = new Product { Id = 1 };

            var task1 = new ProductUpdateTask(p1);
            var task2 = new EntityUpdateTask<Product>(p1, new ProductIndexDefinition(), new TestIndexLocation());

            Assert.AreNotEqual(task1, task2);
        }
        public void Two_of_same_task_type_with_different_entities_should_not_be_equal()
        {
            var p1 = new Product { Id = 1 };
            var p2 = new Product { Id = 2 };

            var task1 = new ProductUpdateTask(p1);
            var task2 = new ProductUpdateTask(p2);

            Assert.AreNotEqual(task1, task2);
        }
Beispiel #4
0
        public void Two_different_task_types_with_same_entity_should_not_be_equal()
        {
            var p1 = new Product {
                Id = 1
            };

            var task1 = new ProductUpdateTask(p1);
            var task2 = new EntityUpdateTask <Product>(p1, new ProductIndexDefinition(), new TestIndexLocation());

            Assert.AreNotEqual(task1, task2);
        }
Beispiel #5
0
        public void Two_tasks_with_same_entity_should_be_equal()
        {
            var p1 = new Product {
                Id = 1
            };

            var task1 = new ProductUpdateTask(p1);
            var task2 = new ProductUpdateTask(p1);

            Assert.AreEqual(task1, task2);
        }
        public void Index_queue_resolves_equality()
        {
            var p1 = new Product { Id = 1 };

            var task1 = new ProductUpdateTask(p1);

            IndexQueue.Instance.Queue(task1);

            var task2 = new ProductUpdateTask(p1);

            Assert.IsTrue(IndexQueue.Instance.Contains(task2));
        }
        public virtual bool Equals(ProductUpdateTask other)
        {
            if (other == null)
                return false;

            if (ReferenceEquals(this, other))
                return true;

            if (!IsTransient(this.entity) && !IsTransient(other.entity))
                return Equals(entity.Id, other.entity.Id);

            return false;
        }
Beispiel #8
0
        public void Index_queue_resolves_equality()
        {
            var p1 = new Product {
                Id = 1
            };

            var task1 = new ProductUpdateTask(p1);

            IndexQueue.Instance.Queue(task1);

            var task2 = new ProductUpdateTask(p1);

            Assert.IsTrue(IndexQueue.Instance.Contains(task2));
        }
Beispiel #9
0
        public void Two_of_same_task_type_with_different_entities_should_not_be_equal()
        {
            var p1 = new Product {
                Id = 1
            };
            var p2 = new Product {
                Id = 2
            };

            var task1 = new ProductUpdateTask(p1);
            var task2 = new ProductUpdateTask(p2);

            Assert.AreNotEqual(task1, task2);
        }
Beispiel #10
0
        public virtual bool Equals(ProductUpdateTask other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (!IsTransient(this.entity) && !IsTransient(other.entity))
            {
                return(Equals(entity.Id, other.entity.Id));
            }


            return(false);
        }