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);
        }
        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));
        }
Пример #5
0
 private static bool IsTransient(Product p)
 {
     return p != null &&
         Equals(p.Id, default(int));
 }
Пример #6
0
 public ProductUpdateTask(Product entity)
 {
     this.entity = entity;
 }