Ejemplo n.º 1
0
        public void AddNewspapers_WithListOfValidNewspaperstestAddsAllItemsToNewspapersCollection()
        {
            //  Arrange
            var paper1 = new Newspaper()
            {
                Name = "Paper 1 name"
            };
            var paper2 = new Newspaper()
            {
                Name = "Paper 2 name"
            };
            var paper3 = new Newspaper()
            {
                Name = "Paper 3 name"
            };
            var paperList = new List <Newspaper> {
                paper1, paper2, paper3
            };

            var ad = new Advertisement {
                Name = "Test ad 1 name", Text = "Test ad 1 text."
            };

            //  Act
            ad.AddNewspapers(paperList);

            //Assert

            ad.Newspapers.ShouldAllBeEquivalentTo(paperList);
        }
Ejemplo n.º 2
0
        public void AddNewspapers_WithNullNewspaperList_ReturnsTheOriginalNewspapersCollection()
        {
            //	Arrange
            var paper1 = new Newspaper()
            {
                Name = "Paper 1 name"
            };
            var paper2 = new Newspaper()
            {
                Name = "Paper 2 name"
            };
            var paper3 = new Newspaper()
            {
                Name = "Paper 3 name"
            };
            var ad = new Advertisement {
                Name = "Test ad 1 name", Text = "Test ad 1 text."
            };
            var paperList = new List <Newspaper> {
                paper1, paper3, paper2
            };

            ad.AddNewspaper(paper1);
            ad.AddNewspaper(paper2);
            ad.AddNewspaper(paper3);

            //  Act

            ad.AddNewspapers(null);

            //	Assert

            ad.Newspapers.ShouldAllBeEquivalentTo(paperList);
        }