public void SetUp()
        {
            theSubject = new Site(){Name = "my site", Id = Guid.NewGuid()};
            theUrls = new ValidStubUrlRegistry();
            theTarget = new SimpleValues<Site>(theSubject);

            theLinks = new LinksSource<Site>();
        }
Example #2
0
        public void SetUp()
        {
            theSubject = new Site()
            {
                Name = "my site", Id = Guid.NewGuid()
            };
            theUrls   = new ValidStubUrlRegistry();
            theTarget = new SimpleValues <Site>(theSubject);

            theLinks = new LinksSource <Site>();
        }
Example #3
0
        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);
        }
        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);
        }