Пример #1
0
        public void GetFeed_HasItems_ReturnsTurboFeedWithFeedItems()
        {
            // Arrange
            _channel = new TurboChannel()
            {
                Title       = "RSS channel name",
                Link        = new Uri("https://turbo-feed.com"),
                Description = "Short RSS channel description",
                Items       = new List <TurboFeedItem>()
                {
                    new TurboFeedItem()
                    {
                        Link    = "https://sample.ru",
                        Author  = "Author 1",
                        Content = "Content 1",
                        PubDate = DateTime.Now,
                        Source  = "https://source2.ru",
                        Topic   = "Item 1",
                        Turbo   = "true"
                    },
                    new TurboFeedItem()
                    {
                        Link    = "https://sample2.ru",
                        Author  = "Author 2",
                        Content = "Content 2",
                        PubDate = DateTime.Now,
                        Source  = "https://source2.ru",
                        Topic   = "Item 2",
                        Turbo   = "false"
                    }
                }
            };
            _turboFeed = new TurboFeed(_channel);

            // Act
            XDocument result = _turboFeed.GetFeed();

            // Assert
            result.Should().NotBeNull();

            XElement root = result.Root;

            root.Should().NotBeNull();

            root.Should().HaveElement(ChannelElementName);
            root.Element(ChannelElementName).HasAttributes.Should().BeFalse();
            root.Element(ChannelElementName).HasElements.Should().BeTrue();
            root.Element(ChannelElementName).Elements("item").Count().Should().Equals(2);
        }
Пример #2
0
 public void SetUp()
 {
     _channel = new TurboChannel()
     {
         Title       = "RSS channel name",
         Link        = new Uri("https://turbo-feed.com"),
         Description = "Short RSS channel description",
         Analytics   = new List <TurboAnalytics>()
         {
             new YandexMetrika("12345")
         },
         AdNetworks = new List <TurboAdNetwork>()
         {
             new YandexAd("yandex-block-id", "yandex_ad_place"),
             new AdFox("adfox-bock-id", AdFoxScript)
         }
     };
     _turboFeed = new TurboFeed(_channel);
 }