Пример #1
0
        public void ChangeAuthor()
        {
            //Arrange
            var book = new Book()
            {
                Id     = 2,
                Title  = "Artificial Intelligence: A Modern Approach (3rd Edition)",
                Author = new Author()
                {
                    Id   = 66,
                    Name = "Mary Poppins",
                    Bio  = ""
                },
                PublishDate = new DateTime(2009, 12, 11),
                Publisher   = "Pearson"
            };

            //Act
            var newAuthor = new Author()
            {
                Id   = 67,
                Name = "Stuart Russell, Peter Norvig",
                Bio  = ""
            };

            book.ChangeAuthor(newAuthor);

            //Assert
            var expectedAuthor = newAuthor;
            var actualAuthor   = book.Author;

            Assert.Equal(expectedAuthor, actualAuthor);
        }
Пример #2
0
        public void ChangeAuthor()
        {
            var book = new Book()
            {
                Id     = 2,
                Title  = "Little Prince",
                Author = new Author()
                {
                    Id   = 10,
                    Name = "Antoine saint-exupery"
                },
                PublishDate = DateTime.Now.AddMonths(-6),
                Publisher   = "Reynal & Hitchcock"
            };

            var newAuthor = new Author()
            {
                Id   = 9,
                Name = "Chipotle"
            };

            book.ChangeAuthor(newAuthor);

            var expextedAuthor = newAuthor;
            var actualAuthor   = book.Author;

            Assert.Equal(expextedAuthor, actualAuthor);
        }
Пример #3
0
        public void ChangeAuthor()
        {
            //Arrange
            var book = new Book()
            {
                Id     = 1,
                Title  = "Domain Driven Design",
                Author = new Author()
                {
                    Id   = 65,
                    Name = "Eric Evans"
                },
                PublishDate = DateTime.Now.AddMonths(2),
                Publisher   = "McGraw-Hill"
            };

            //Act
            var newAuthor = new Author()
            {
                Id = 64, Name = "J.D. Salinger"
            };

            book.ChangeAuthor(newAuthor);

            //Assert
            var expectedAuthor = newAuthor;
            var actualAuthor   = book.Author;

            Assert.Equal(expectedAuthor, actualAuthor);
        }
Пример #4
0
        public void ChangeAuthor()
        {
            var book = new Book()
            {
                Id     = 2,
                Title  = "Domain Driven Designs",
                Author = new Author()
                {
                    Id   = 66,
                    Name = "Eric Evans"
                },
                PublishDate = DateTime.Now.AddMonths(-6),
                Publisher   = "McGraw-Hill"
            };
            var newAuthor = new Author()
            {
                Id   = 66,
                Name = "Eric Evans2"
            };

            book.ChangeAuthor(newAuthor);

            var expectedAuthorName = "Eric Evans2";
            var actualAuthor       = book.Author.Name;

            // Was going to do object comparison but just checked their names instead
            Assert.Equal(expectedAuthorName, actualAuthor);
        }