Exemplo n.º 1
0
        public async Task UpdateCompany_NotFound()
        {
            //Arrange
            UnityOfWorkContract    unityOfWork    = new ResolveMock().Resolve();
            CompanyServiceContract companyService = new CompanyService(unityOfWork);
            CompanyAppContract     _companyApp    = new CompanyApp(unityOfWork, companyService);

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

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

            //Assert
            Assert.AreEqual(true, company.EventNotification.Warnings.Select(x => x.ToString()).Contains("Empresa não encontrada."));
        }
Exemplo n.º 2
0
        public async Task UpdateCompany_StateEmpty()
        {
            //Arrange
            UnityOfWorkContract    unityOfWork    = new ResolveMock().Resolve();
            CompanyServiceContract companyService = new CompanyService(unityOfWork);
            CompanyAppContract     _companyApp    = new CompanyApp(unityOfWork, companyService);

            Company company = new Company("10793548000190", "Company Name", null);

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

            //Assert
            Assert.AreEqual(true, company.EventNotification.Warnings.Select(x => x.ToString()).Contains("Estado é obrigatório."));
        }
Exemplo n.º 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);
        }