public async Task CreateCompany_AlreadExists() { //Arrange UnityOfWorkContract unityOfWork = new ResolveMock().Resolve(); CompanyServiceContract companyService = new CompanyService(unityOfWork); CompanyAppContract _companyApp = new CompanyApp(unityOfWork, companyService); Company company = new Company("68522679000112", "Company Name", null); //Act company = await _companyApp.Create(company); //Assert Assert.AreEqual(true, company.EventNotification.Warnings.Select(x => x.ToString()).Contains("Empresa já Cadastrada.")); }
public async Task CreateCompany_CNPJ_Wrong() { //Arrange UnityOfWorkContract unityOfWork = new ResolveMock().Resolve(); CompanyServiceContract companyService = new CompanyService(unityOfWork); CompanyAppContract _companyApp = new CompanyApp(unityOfWork, companyService); Company company = new Company("10793548000191", "Company Name", State.Acre); //Act company = await _companyApp.Create(company); //Assert Assert.AreEqual(true, company.EventNotification.Warnings.Select(x => x.ToString()).Contains("CNPJ Inválido.")); }
public async Task CreateCompany_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.Create(company); //Assert Assert.AreEqual(true, company.EventNotification.Warnings.Select(x => x.ToString()).Contains("Estado é obrigatório.")); }
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); }