public void ReturnAllCompanies()
        {
            // Arragne
            var contextMock = this.ContextMock;

            var companies = this.Companies;

            var companySetMock = new Mock <IDbSet <Company> >();

            companySetMock.As <IQueryable <Company> >().Setup(m => m.Provider).Returns(companies.AsQueryable().Provider);
            companySetMock.As <IQueryable <Company> >().Setup(m => m.Expression).Returns(companies.AsQueryable().Expression);
            companySetMock.As <IQueryable <Company> >().Setup(m => m.ElementType).Returns(companies.AsQueryable().ElementType);
            companySetMock.As <IQueryable <Company> >().Setup(m => m.GetEnumerator()).Returns(companies.AsQueryable().GetEnumerator());

            contextMock.Setup(c => c.Companies).Returns(companySetMock.Object);

            ICompanyService companyService = new Bills.Services.CompanyService(contextMock.Object);

            // Act
            var result = companyService.GetAllCompanies();

            // Assert
            contextMock.Verify(c => c.Companies, Times.Once);
            CollectionAssert.AreEquivalent(companies, result.ToList());
        }
        public void ReturnSpeficifName_WhenTheNameIsValid()
        {
            var contextMocked    = this.ContextMock;
            var companies        = this.Companies;
            var companyName      = "Company03";
            var companiesSetMock = QueryableDbSetMock.GetQueryableMockDbSetFromArray(companies);

            contextMocked.Setup(b => b.Companies).Returns(companiesSetMock.Object);

            var companyService = new Bills.Services.CompanyService(contextMocked.Object);

            var expectedResult = companies.FirstOrDefault(c => c.Name == companyName);
            var result         = companyService.GetCompanyByName(companyName);

            Assert.AreSame(expectedResult, result);
        }