예제 #1
0
 public void testCustomTemplatePopulationWithSpecificBean()
 {
     string str = "Name: George BushAddress: 1600 Pennsylvania Ave. (c/o Laura), Washington, DC 20500Product Number: 202-456-1Qty: 57";
     StringTheory theory = new StringTheory("Name: $Built.Text.UnitTests.PersonBean.FirstName $Built.Text.UnitTests.PersonBean.LastNameAddress: $Built.Text.UnitTests.PersonBean.Address1 $Built.Text.UnitTests.PersonBean.Address2, $Built.Text.UnitTests.PersonBean.City, $Built.Text.UnitTests.PersonBean.State $Built.Text.UnitTests.PersonBean.ZipProduct Number: $Built.Text.UnitTests.OrderBean.ProductNumberQty: $Built.Text.UnitTests.OrderBean.Quantity");
     theory.PopulateExact(this.CreatePersonBean(), "$*");
     theory.PopulateExact(this.CreateOrderBean(), "$*");
     Assert.True(str.Equals(theory.ToString()), "Populated template doesn't match reference string.");
 }
예제 #2
0
 public void testTemplatePopulationWithListOfSpecificBeans()
 {
     string str = "Name: George BushAddress: 1600 Pennsylvania Ave. (c/o Laura), Washington, DC 20500Product Number: 202-456-1Qty: 57";
     StringTheory theory = new StringTheory("Name: %Built.Text.UnitTests.PersonBean.FirstName% %Built.Text.UnitTests.PersonBean.LastName%Address: %Built.Text.UnitTests.PersonBean.Address1% %Built.Text.UnitTests.PersonBean.Address2%, %Built.Text.UnitTests.PersonBean.City%, %Built.Text.UnitTests.PersonBean.State% %Built.Text.UnitTests.PersonBean.Zip%Product Number: %Built.Text.UnitTests.OrderBean.ProductNumber%Qty: %Built.Text.UnitTests.OrderBean.Quantity%");
     object[] list = new object[] { this.CreatePersonBean(), this.CreateOrderBean() };
     theory.PopulateExact(list, "%*%");
     Assert.True(str.Equals(theory.ToString()), "Populated template doesn't match reference string." + theory);
 }