示例#1
0
        public void GetFiltered_SpecificKOrder_DescendingOrder_Test()
        {
            // Act
            var target = new ListRepository();

            // Act
            target.GetFiltered(e => e.Id == 1, t => t.Id, false);
        }
示例#2
0
        public void Attach_NullItem_Test()
        {
            // Act
            var target = new ListRepository();

            // Act
            target.Attach(null);
        }
示例#3
0
        public void GetFiltered_SpecificKOrder_DescendingOrderAndFilterNullThrowArgumentNullException_Test()
        {
            // Act
            var target = new ListRepository();

            // Act
            target.GetFiltered(null, t => t.Id, false);
        }
示例#4
0
        public void ApplyChanges_NullEntityThrowNewArgumentNullException_Test()
        {
            // Act
            var target = new ListRepository();

            // Assert
            target.Modify(null);
        }
示例#5
0
        public void GetFiltered_FilterNullThrowArgumentNullException_Test()
        {
            // Act
            var target = new ListRepository();

            // Act
            target.GetFiltered(null);
        }
示例#6
0
        public void ApplyChanges_Test()
        {
            // Act
            var    target = new ListRepository();
            Entity item   = target.GetAll().First();

            // Assert
            target.Modify(item);
        }
示例#7
0
        public void Add_NullItemThrowArgumentNullException_Test()
        {
            // Act
            var    target = new ListRepository();
            Entity entity = null;

            // Act
            target.Add(entity);
        }
示例#8
0
        public void Delete_NullItem_Test()
        {
            // Act
            var    target = new ListRepository();
            Entity entity = null;

            // Act
            target.Remove(entity);
        }
示例#9
0
        public void GetAllTest()
        {
            // Act
            var target = new ListRepository();

            // Act
            IEnumerable <Entity> result = target.GetAll();

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Count() == 1);
        }
示例#10
0
        public void GetFilteredTest()
        {
            // Act
            var target = new ListRepository();

            // Act
            IEnumerable <Entity> result = target.GetFiltered(e => e.Id == 1);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Count() == 1);
            Assert.IsTrue(result.First().Id == 1);
        }
示例#11
0
        public void GetPaged_DescendingOrder_Test()
        {
            // Act
            var target    = new ListRepository();
            int pageIndex = 0;
            int pageCount = 1;

            // Act
            PagedElements <Entity> result = target.GetPaged(pageIndex, pageCount, e => true, e => e.Id, false);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.TotalElements);
        }
示例#12
0
        public void GetFilteredAndOrderedAndPagedElements_InvalidPageIndexThrowArgumentException_Test()
        {
            // Act
            var target    = new ListRepository();
            int pageIndex = -1;
            int pageCount = 1;

            // Act
            PagedElements <Entity> result = target.GetPaged(
                pageIndex,
                pageCount,
                e => e.Id == 1,
                null,
                false);
        }
示例#13
0
        public void Attach_Test()
        {
            // Act
            var target = new ListRepository();
            var entity = new Entity
            {
                Id             = 5,
                SampleProperty = "Sample 5"
            };

            // Act
            target.Attach(entity);

            // Assert
            Assert.IsTrue(target.GetFiltered(t => t.Id == 5).Count() == 1);
        }
示例#14
0
        public void DeleteTest()
        {
            // Act
            var target = new ListRepository();

            // Act
            IEnumerable <Entity> result = target.GetAll();

            Entity firstEntity = result.First();

            target.Remove(firstEntity);

            IEnumerable <Entity> postResult = target.GetAll();

            // Assert
            Assert.IsNotNull(postResult);
            Assert.IsFalse(postResult.Contains(firstEntity));
        }
示例#15
0
        public void AddTest()
        {
            // Act
            var target = new ListRepository();
            var entity = new Entity
            {
                Id             = 4,
                SampleProperty = "Sample 4"
            };

            // Act
            target.Add(entity);
            IEnumerable <Entity> result = target.GetAll();

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Count() == 2);
            Assert.IsTrue(result.Contains(entity));
        }
示例#16
0
        public void GetFiltered_WithDescendingOrderedAndPagedElements_Test()
        {
            // Act
            var target    = new ListRepository();
            int pageIndex = 0;
            int pageCount = 1;

            // Act
            PagedElements <Entity> result = target.GetPaged(
                pageIndex,
                pageCount,
                e => e.Id == 1,
                e => e.Id,
                false);

            // Assert
            Assert.IsTrue(result != null);
            Assert.IsTrue(result.TotalElements == 1);
        }
示例#17
0
 /// <summary>
 /// A test for Container
 /// </summary>
 public void unitOfWorkTestHelper <T>()
     where T : class
 {
     // Act
     var target = new ListRepository();
 }