public void find_values_invokes_the_fubu_request() { var request = new InMemoryFubuRequest(); var address = new Address(); request.Set(address); var source = new ValueSource<Address>(request); source.FindValues().ShouldBeOfType<SimpleValues<Address>>() .Subject.ShouldBeTheSameAs(address); }
public void SetUp() { anAddress = new Address{ Line1 = "22 Cherry Lane", City = "Austin", State = "TX", ZipCode = "78703" }; aTarget = new SimpleValues<Address>(anAddress); aNode = XmlAttCentricMediaNode.ForRoot("root"); }
public void create_a_projection() { var projection = new XmlProjection<Address>(); projection.Value(x => x.Line1); projection.Value(x => x.Line2); projection.Value(x => x.City); var address = new Address{ City = "Austin", Line1 = "1718 W 10th St", Line2 = "Unit A" }; var document = projection.Write(address); document.OuterXml.ShouldEqual( "<Address><Line1>1718 W 10th St</Line1><Line2>Unit A</Line2><City>Austin</City></Address>"); }
public void SetUp() { var projection = new Projection<Address>(DisplayFormatting.RawValues); projection.Value(x => x.Address1); projection.Value(x => x.Address2); projection.Value(x => x.City); projection.Value(x => x.StateOrProvince).Name("State"); theXmlMediaOptions = new XmlMediaOptions(){ Root = "Address" }; theDocument = new XmlMediaDocument(theXmlMediaOptions); var urls = new StubUrlRegistry(); var linkSource = new LinksSource<Address>(); linkSource.ToSubject().Rel("self"); linkSource.To(a => new AddressAction("change")).Rel("change"); linkSource.To(a => new AddressAction("delete")).Rel("delete"); theOutput = new InMemoryOutputWriter(); var media = new MediaWriter<Address>(theDocument, linkSource, urls, projection, null, theOutput); theAddress = new Address(){ Address1 = "22 Cherry Lane", Address2 = "Apt A", City = "Austin", StateOrProvince = "Texas" }; media.Write("text/plain", theAddress); Debug.WriteLine(theOutput); }