Example #1
0
        public void TestToString()
        {
            using (var reader = EntityDataMock.mockAddressReader())
            {
                string correctString = $"" +
                                       $"{reader["country"]}, {reader["city"]}, " +
                                       $"{reader["postal_code"]}, {reader["street"]} " +
                                       $"{reader["building_number"]}/{reader["apartment_number"]}";

                Address addr = new Address(reader);
                Assert.AreEqual(addr.ToString(), correctString);
            }
        }
Example #2
0
        public void TestToUpdateSuccess()
        {
            using (var reader = EntityDataMock.mockAddressReader())
            {
                Address addr          = new Address(reader);
                string  correctString = $"city='{reader["city"]}', " +
                                        $"postal_code='{reader["postal_code"]}', " +
                                        $"country='{reader["country"]}', street='{reader["street"]}', " +
                                        $"building_number={reader["building_number"]}, " +
                                        $"apartment_number={reader["apartment_number"]}";

                Assert.AreEqual(addr.ToUpdate(), correctString);
            }
        }
Example #3
0
        public void TestToInsertSuccess()
        {
            using (var reader = EntityDataMock.mockAddressReader())
            {
                Address addr          = new Address(reader);
                string  correctString = $"" +
                                        $"(city, postal_code, country, street, building_number, apartment_number)" +
                                        $" VALUES ('{reader["city"]}', '{reader["postal_code"]}'," +
                                        $" '{reader["country"]}', '{reader["street"]}', " +
                                        $"{reader["building_number"]}, {reader["apartment_number"]});";


                Assert.AreEqual(addr.ToInsert(), correctString);
            }
        }
Example #4
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);
                }
            }
        }
Example #5
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);
                }
            }
        }
Example #6
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);
                }
            }
        }
Example #7
0
        public void testToString()
        {
            using (var personReader = EntityDataMock.mockPersonReader())
            {
                using (var addrReader = EntityDataMock.mockAddressReader())
                {
                    string correctString = $"" +
                                           $"{personReader["name"]} {personReader["surname"]} - " +
                                           $"{addrReader["country"]}, {addrReader["city"]}, " +
                                           $"{addrReader["postal_code"]}, {addrReader["street"]} " +
                                           $"{addrReader["building_number"]}/{addrReader["apartment_number"]}";

                    Address addr   = new Address(addrReader);
                    Person  person = new Person(personReader);
                    person.address = addr;
                    Assert.AreEqual(person.ToString(), correctString);
                }
            }
        }