Beispiel #1
0
        public async Task DeleteCompany()
        {
            //Arrange
            UnityOfWorkContract    unityOfWork    = new ResolveMock().Resolve();
            CompanyServiceContract companyService = new CompanyService(unityOfWork);
            CompanyAppContract     _companyApp    = new CompanyApp(unityOfWork, companyService);

            Company company = new Company("68522679000112", "", null);

            //Act
            company = await _companyApp.Delete(company);

            CompanyList itens = await _companyApp.Get();

            //Assert
            Assert.AreEqual(3, itens.Itens.Count);
        }
Beispiel #2
0
        public async Task CreateCompany()
        {
            //Arrange
            UnityOfWorkContract    unityOfWork    = new ResolveMock().Resolve();
            CompanyServiceContract companyService = new CompanyService(unityOfWork);
            CompanyAppContract     _companyApp    = new CompanyApp(unityOfWork, companyService);

            Company company = new Company("10793548000190", "Company Name", State.Acre);

            //Act
            company = await _companyApp.Create(company);

            CompanyList itens = await _companyApp.Get();

            //Assert
            Assert.AreEqual(true, company.IsValid());
            Assert.AreEqual(5, itens.Itens.Count);
        }
Beispiel #3
0
        public async Task UpdateCompany()
        {
            string newName  = "Company Name alt";
            State  newState = State.SantaCatarina;
            //Arrange
            UnityOfWorkContract    unityOfWork    = new ResolveMock().Resolve();
            CompanyServiceContract companyService = new CompanyService(unityOfWork);
            CompanyAppContract     _companyApp    = new CompanyApp(unityOfWork, companyService);

            Company company = new Company("68522679000112", newName, newState);

            //Act
            company = await _companyApp.Update(company);

            Company companyUpdated = await _companyApp.Get(company.CNPJ);

            //Assert
            Assert.AreEqual(true, companyUpdated.CompanyName == newName && companyUpdated.State == newState);
        }