示例#1
0
        public void Setup()
        {
            _kayakoApiRequest = new Mock <IKayakoApiRequest>();
            _newsController   = new NewsController(_kayakoApiRequest.Object);

            _responseNewsCategoryCollection = new NewsCategoryCollection
            {
                new NewsCategory(),
                new NewsCategory()
            };

            _responseNewsItemCollection = new NewsItemCollection
            {
                new NewsItem(),
                new NewsItem()
            };

            _responseNewsSubscriberCollection = new NewsSubscriberCollection
            {
                new NewsSubscriber(),
                new NewsSubscriber(),
                new NewsSubscriber()
            };

            _responseNewsItemCommentCollection = new NewsItemCommentCollection
            {
                new NewsItemComment(),
                new NewsItemComment()
            };
        }
        public void NewsItemCommentCollectionDeserialization()
        {
            var newsItemCommentCollection = new NewsItemCommentCollection
            {
                new NewsItemComment
                {
                    Id              = 320,
                    NewsItemId      = 41,
                    CreatorType     = NewsItemCommentCreatorType.User,
                    CreatorId       = 1,
                    FullName        = "Jon doe",
                    Email           = string.Empty,
                    IpAddress       = "127.0.0.1",
                    DateLine        = new UnixDateTime(1340037804),
                    ParentCommentId = 0,
                    CommentStatus   = NewsItemCommentStatus.Approved,
                    UserAgent       = string.Empty,
                    Referrer        = string.Empty,
                    ParentUrl       = string.Empty,
                    Contents        = "Created by API on news"
                },
                new NewsItemComment
                {
                    Id              = 321,
                    NewsItemId      = 41,
                    CreatorType     = NewsItemCommentCreatorType.User,
                    CreatorId       = 1,
                    FullName        = "Simaranjit Singh",
                    Email           = string.Empty,
                    IpAddress       = "127.0.0.1",
                    DateLine        = new UnixDateTime(1340037801),
                    ParentCommentId = 0,
                    CommentStatus   = NewsItemCommentStatus.Approved,
                    UserAgent       = string.Empty,
                    Referrer        = string.Empty,
                    ParentUrl       = string.Empty,
                    Contents        = "Created by API on news"
                }
            };

            var expectedNewsItemCommentCollection = XmlDataUtility.ReadFromFile <NewsItemCommentCollection>("TestData/NewsItemCommentCollection.xml");

            AssertUtility.ObjectsEqual(expectedNewsItemCommentCollection, newsItemCommentCollection);
        }
        public void NewsItemCommentCollectionDeserialization()
        {
            var newsItemCommentCollection = new NewsItemCommentCollection
                {
                    new NewsItemComment
                        {
                            Id = 320,
                            NewsItemId = 41,
                            CreatorType = NewsItemCommentCreatorType.User,
                            CreatorId = 1,
                            FullName = "Jon doe",
                            Email = "",
                            IpAddress = "127.0.0.1",
                            DateLine = new UnixDateTime(1340037804),
                            ParentCommentId = 0,
                            CommentStatus = NewsItemCommentStatus.Approved,
                            UserAgent = "",
                            Referrer = "",
                            ParentUrl = "",
                            Contents = "Created by API on news"
                        },
                    new NewsItemComment
                        {
                            Id = 321,
                            NewsItemId = 41,
                            CreatorType = NewsItemCommentCreatorType.User,
                            CreatorId = 1,
                            FullName = "Simaranjit Singh",
                            Email = "",
                            IpAddress = "127.0.0.1",
                            DateLine = new UnixDateTime(1340037801),
                            ParentCommentId = 0,
                            CommentStatus = NewsItemCommentStatus.Approved,
                            UserAgent = "",
                            Referrer = "",
                            ParentUrl = "",
                            Contents = "Created by API on news"
                        }
                };

            var expectedNewsItemCommentCollection = XmlDataUtility.ReadFromFile<NewsItemCommentCollection>("TestData/NewsItemCommentCollection.xml");

            AssertUtility.ObjectsEqual(expectedNewsItemCommentCollection, newsItemCommentCollection);
        }
        public void Setup()
        {
            _kayakoApiRequest = new Mock<IKayakoApiRequest>();
            _newsController = new NewsController(_kayakoApiRequest.Object);

            _responseNewsCategoryCollection = new NewsCategoryCollection
                {
                    new NewsCategory(),
                    new NewsCategory()
                };

            _responseNewsItemCollection = new NewsItemCollection
                {
                    new NewsItem(),
                    new NewsItem()
                };

            _responseNewsSubscriberCollection = new NewsSubscriberCollection
                {
                    new NewsSubscriber(),
                    new NewsSubscriber(),
                    new NewsSubscriber()
                };

            _responseNewsItemCommentCollection = new NewsItemCommentCollection
                {
                    new NewsItemComment(),
                    new NewsItemComment()
                };
        }