예제 #1
0
            public XmlRpcSerializer()
            {
                Mapper.Initialize((config) =>
                {
                    config.CreateMap <PostStatus, string>().ConvertUsing(src => src.ToRPC());
                    config.CreateMap <PostOrderBy, string>().ConvertUsing(src => src.ToRPC());
                    config.CreateMap <Order, string>().ConvertUsing(src => src.ToRPC());
                    config.CreateMap <Rpc.PostFilter, PostFilterProxy>()
                    .ForMember(
                        dest => dest.PostStatus,
                        opt => opt.MapFrom(
                            source => new string[] { Mapper.Map <string>(source.PostStatus) }
                            )
                        );
                });

                var doc = new XmlDocument();

                doc.Load("SampleData/getpost.xml");

                var response = new CookComputing.XmlRpc.XmlRpcSerializer().DeserializeResponse(
                    doc,
                    typeof(Rpc.Post)
                    );

                this._subject  = response.retVal as Rpc.Post;
                this._expected = this.ExpectedPost();
            }
예제 #2
0
            public XmlRpcSerializer()
            {
                Mapper.Initialize((config) =>
                {
                    config.CreateMap<PostStatus, string>().ConvertUsing(src => src.ToRPC());
                    config.CreateMap<PostOrderBy, string>().ConvertUsing(src => src.ToRPC());
                    config.CreateMap<Order, string>().ConvertUsing(src => src.ToRPC());
                    config.CreateMap<Rpc.PostFilter, PostFilterProxy>()
                        .ForMember(
                            dest => dest.PostStatus,
                            opt => opt.MapFrom(
                                source => new string[] { Mapper.Map<string>(source.PostStatus) }
                            )
                        );
                });

                var doc = new XmlDocument();
                doc.Load("SampleData/getpost.xml");

                var response = new CookComputing.XmlRpc.XmlRpcSerializer().DeserializeResponse(
                        doc,
                        typeof(Rpc.Post)
                    );

                this._subject = response.retVal as Rpc.Post;
                this._expected = this.ExpectedPost();
            }
예제 #3
0
            private Rpc.Post ExpectedPost()
            {
                // values taken from SampleData/getpost.xml
                var post = new Rpc.Post();

                post.Id              = "21991";
                post.Title           = "Wedding Blog: Guests That Don't RSVP!";
                post.PostDate        = "20101231T00:00:00".ToISO8601DateTime();
                post.PostDateGMT     = "20101231T00:00:00".ToISO8601DateTime();
                post.PostModified    = "20120423T21:17:01".ToISO8601DateTime();
                post.PostModifiedGMT = "20120423T21:17:01".ToISO8601DateTime();
                post.Status          = "publish";
                post.Type            = "post";
                post.Name            = "wedding-blog-guests-that-dont-rsvp";
                post.AuthorId        = "1";
                post.Password        = string.Empty;
                post.Excerpt         = string.Empty;
                post.Parent          = "0";
                post.MIMEType        = string.Empty;
                post.Link            = "http://blogs.slice.dev.smdg.ca/wedding-blog-guests-that-dont-rsvp/";

                post.GUID          = "http://blog.slice.ca/wedding-blog-guests-that-dont-rsvp/";
                post.MenuOrder     = 0;
                post.CommentStatus = "open";
                post.PingStatus    = "open";
                post.Sticky        = false;
                post.Terms         = new Term[] {
                    new Term {
                        Id = "10", Name = "Weddings", Slug = "weddings", Group = "0", TaxonomyId = "10", Taxonomy = "category", Description = "Weddings", Parent = "0", Count = 69
                    }
                };

                post.CustomFields = new CustomField[] {
                    new CustomField {
                        Id = "54400", Key = "aa", Value = "2010"
                    },
                    new CustomField {
                        Id = "54380", Key = "action", Value = "editpost"
                    },
                    new CustomField {
                        Id = "54434", Key = "advanced_view", Value = "1"
                    },
                    new CustomField {
                        Id = "54388", Key = "autosavenonce", Value = "37b9c93717"
                    }
                };
                return(post);
            }
예제 #4
0
            private Rpc.Post ExpectedPost()
            {
                // values taken from SampleData/getpost.xml
                var post = new Rpc.Post();
                post.Id = "21991";
                post.Title = "Wedding Blog: Guests That Don't RSVP!";
                post.PostDate = "20101231T00:00:00".ToISO8601DateTime();
                post.PostDateGMT = "20101231T00:00:00".ToISO8601DateTime();
                post.PostModified = "20120423T21:17:01".ToISO8601DateTime();
                post.PostModifiedGMT = "20120423T21:17:01".ToISO8601DateTime();
                post.Status = "publish";
                post.Type = "post";
                post.Name = "wedding-blog-guests-that-dont-rsvp";
                post.AuthorId = "1";
                post.Password = string.Empty;
                post.Excerpt = string.Empty;
                post.Parent = "0";
                post.MIMEType = string.Empty;
                post.Link = "http://blogs.slice.dev.smdg.ca/wedding-blog-guests-that-dont-rsvp/";

                post.GUID = "http://blog.slice.ca/wedding-blog-guests-that-dont-rsvp/";
                post.MenuOrder = 0;
                post.CommentStatus = "open";
                post.PingStatus = "open";
                post.Sticky = false;
                post.Terms = new Term[]{
                    new Term{ Id = "10", Name = "Weddings", Slug="weddings", Group="0", TaxonomyId="10", Taxonomy="category", Description="Weddings", Parent="0", Count=69 }
                };

                post.CustomFields = new CustomField[]{
                    new CustomField{ Id = "54400", Key = "aa", Value="2010" },
                    new CustomField{ Id = "54380", Key = "action", Value="editpost" },
                    new CustomField{ Id = "54434", Key = "advanced_view", Value="1" },
                    new CustomField{ Id = "54388", Key = "autosavenonce", Value="37b9c93717" }
                };
                return post;
            }