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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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));
        }
Exemplo n.º 7
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;
        }
Exemplo n.º 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));
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }