public void AddCompany_throws_on_null_or_empty_name() { var companyWithNullName = new Company() { Name = null }; var companyWithEmptyName = new Company() { Name = String.Empty }; var repo = new SqlFulcrumRepository(this.contextMock.Object); Assert.Throws<ArgumentException>(() => repo.AddCompany(companyWithNullName)); Assert.Throws<ArgumentException>(() => repo.AddCompany(companyWithEmptyName)); }
public void AddCompany_passes_valid_company_with_default_id_to_dbcontext() { var company = new Company() { Name = "Echo Corporation" }; this.contextMock.Setup(c => c.Companies.Add(It.IsAny<Company>())).Verifiable(); var repo = new SqlFulcrumRepository(this.contextMock.Object); repo.AddCompany(company); this.contextMock.Verify(c => c.Companies.Add(company)); }
public void AddCompany_throws_on_null_input() { var repo = new SqlFulcrumRepository(this.contextMock.Object); Assert.Throws<ArgumentNullException>(() => repo.AddCompany(null)); }