public void GetAll_OrderByDescending()
        {
            var ar0 = new BaseEntity
                          {
                              Id = Guid.NewGuid()
                          };

            var ar1 = new BaseEntity
                          {
                              Id = Guid.NewGuid()
                          };

            var ar2 = new BaseEntity
                          {
                              Id = Guid.NewGuid()
                          };

            using (_mockRepository.Record())
            {
                _repository.Stub(x => x.Table)
                    .Return(new List<BaseEntity> { ar1, ar2, ar0 }.AsQueryable());
            }

            var result = _service.GetAll(0, 10);

            Assert.AreEqual(result[0].Id, ar1.Id);
            Assert.AreEqual(result[1].Id, ar2.Id);
            Assert.AreEqual(result[2].Id, ar0.Id);
        }
        public void Delete_ExpectCallDelete()
        {
            var entity = new BaseEntity();

            using (_mockRepository.Record())
            {
                _repository.Expect(x => x.Delete(entity));
                _repository.Expect(x => x.SaveChanges());
            }

            _service.Delete(entity);

            _repository.VerifyAllExpectations();
        }
        public void GetEntityById_Founded()
        {
            var id = Guid.NewGuid();
            var entity = new BaseEntity { Id = id };

            using (_mockRepository.Record())
            {
                _repository.Stub(x => x.Find(y => y.Id == Guid.Empty))
                    .IgnoreArguments()
                    .Return(new List<BaseEntity>
                                {
                                    entity
                                });
            }

            var result = _service.GetEntityById(id);

            Assert.IsNotNull(result);
        }