public void GivenListOfContractsWhenFilteringContractsNonMeetingFilterCriteriaThenNoContractsAreReturned()
        {
            var contracts = new Contract[]
            {
                new Contract { Id = 1, Name = "C1", Type = ContractType.Developer, Experience = 3, Salary = 5000 },
                new Contract { Id = 2, Name = "C2", Type = ContractType.Tester, Experience = 3, Salary = 3000 },
                new Contract { Id = 3, Name = "C3", Type = ContractType.Developer, Experience = 5, Salary = 8000 },
                new Contract { Id = 4, Name = "C4", Type = ContractType.Tester, Experience = 5, Salary = 6000 },
                new Contract { Id = 5, Name = "C5", Type = ContractType.Developer, Experience = 1, Salary = 3000 }
            }.AsQueryable();
            var mock = new Mock<IRepository<Contract>>();
            mock.Setup(m => m.Items).Returns(contracts);
            IContractService service = new ContractService(mock.Object, null, null);
            var filterCriteria = new ColumnFilterInfo[]
            {
                new ColumnFilterInfo { Type = ColumnFilterType.ContractType, Value = ContractType.Developer.ToString() },
                new ColumnFilterInfo { Type = ColumnFilterType.ContractExperience, Value = 4 }
            };

            var actual = service.GetAllContracts(filterCriteria, 1, 10);

            Assert.IsFalse(actual.Contracts.Any());
            Assert.AreEqual(0, actual.TotalRecords);
        }
        public void GivenListOfContractsWhenFilteringDeveloperContractsThenDeveloperContractsOnlyAreReturned()
        {
            var contracts = new Contract[]
            {
                new Contract { Id = 1, Name = "C1", Type = ContractType.Developer, Experience = 3, Salary = 5000 },
                new Contract { Id = 2, Name = "C2", Type = ContractType.Tester, Experience = 3, Salary = 3000 },
                new Contract { Id = 3, Name = "C3", Type = ContractType.Developer, Experience = 5, Salary = 8000 },
                new Contract { Id = 4, Name = "C4", Type = ContractType.Tester, Experience = 5, Salary = 6000 },
                new Contract { Id = 5, Name = "C5", Type = ContractType.Developer, Experience = 1, Salary = 3000 }
            }.AsQueryable();
            var mock = new Mock<IRepository<Contract>>();
            mock.Setup(m => m.Items).Returns(contracts);
            IContractService service = new ContractService(mock.Object, null, null);
            var filterCriteria = new ColumnFilterInfo[]
            {
                new ColumnFilterInfo { Type = ColumnFilterType.ContractType, Value = ContractType.Developer.ToString() }
            };

            var actual = service.GetAllContracts(filterCriteria, 1, 10);

            Assert.IsTrue(actual.Contracts.All(c => c is DtoContract));
            Assert.AreEqual(3, actual.Contracts.Count());
            Assert.AreEqual(3, actual.TotalRecords);
            Assert.AreEqual("C1", actual.Contracts.ElementAt(0).Name, true);
            Assert.AreEqual("C3", actual.Contracts.ElementAt(1).Name, true);
            Assert.AreEqual("C5", actual.Contracts.ElementAt(2).Name, true);
        }