public void TestToInsertSuccess() { using (var companyReader = EntityDataMock.mockCompanyReader()) { using (var addrReader = EntityDataMock.mockAddressReader()) { Address addr = new Address(addrReader); addr.id = 5; Company company = new Company(companyReader); company.address = addr; string correctString = $"(id, name, tax_number, address_id) " + $"VALUES (NULL, '{companyReader["name"]}', '{companyReader["tax_number"]}', " + $"{addr.id});"; Assert.AreEqual(company.ToInsert(), correctString); } } }
public void TestToUpdateSuccess() { using (var companyReader = EntityDataMock.mockCompanyReader()) { using (var addrReader = EntityDataMock.mockAddressReader()) { Address addr = new Address(addrReader); addr.id = 5; Company company = new Company(companyReader); company.address = addr; string correctString = $"name='{companyReader["name"]}', " + $"tax_number='{companyReader["tax_number"]}'," + $" address_id={addr.id}"; Assert.AreEqual(company.ToUpdate(), correctString); } } }
public void TestToString() { using (var companyReader = EntityDataMock.mockCompanyReader()) { using (var addrReader = EntityDataMock.mockAddressReader()) { string correctString = $"" + $"{companyReader["name"]} - " + $"{addrReader["country"]}, {addrReader["city"]}, " + $"{addrReader["postal_code"]}, {addrReader["street"]} " + $"{addrReader["building_number"]}/{addrReader["apartment_number"]}"; Address addr = new Address(addrReader); Company company = new Company(companyReader); company.address = addr; Assert.AreEqual(company.ToString(), correctString); } } }