コード例 #1
0
        public void ChangeBookTitle()
        {
            var book2 = new Book()
            {
                Id     = 2,
                Title  = "Gone Girl",
                Author = new Author()
                {
                    Id   = 34,
                    Name = "Gillian Flynn",
                    Bio  = "A great author",
                },
                publishDate = DateTime.Now.AddMonths(-6),
                Publisher   = "Crown Publishing"
            };
            //Act
            var newBookTitle = "Test Title";

            book2.ChangeBookTitle(newBookTitle);

            //Assert
            var expectedTitle = newBookTitle;
            var actualTitle   = book2.Title;

            Assert.Equal(expectedTitle, actualTitle);
        }
コード例 #2
0
        public void ChangeBookTitle()
        {
            var book = new Book()
            {
                Id     = 1,
                Title  = "Domain Driven Design",
                Author = new Author()
                {
                    Id   = 65,
                    Name = "Eric Evans"
                },
                PublishDate = DateTime.Now.AddMonths(-6),
                Publisher   = "McGraw-Hill"
            };

            var newBookTitle = "Test";

            book.ChangeBookTitle(newBookTitle);

            var expectedBookTitle = newBookTitle;
            var actualBookTitle   = "Test";

            Assert.Equal(expectedBookTitle, actualBookTitle);
        }