Exemplo n.º 1
0
        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);
                }
            }
        }
Exemplo n.º 2
0
        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);
                }
            }
        }
Exemplo n.º 3
0
        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);
                }
            }
        }