Exemple #1
0
        public void ChangePublicationDate()
        {
            //Arrange
            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"
            };

            //Act
            var newPublicationDate = DateTime.Now.AddMonths(2);

            book.ChangePublicationDate(newPublicationDate);

            //Assert
            var expectedPublicationDate = newPublicationDate.ToShortDateString();
            var actualPublicationDate   = book.PublishDate.ToShortDateString();

            Assert.Equal(expectedPublicationDate, actualPublicationDate);
        }
Exemple #2
0
                public void ChangePublicationDate()
                
        {
                        //Arrange
                        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"
                                                          
            };

                        //Act
                        var newPublicationDate = DateTime.Now.AddMonths(2);

                        book.ChangePublicationDate(newPublicationDate);
                        

                        //Assert
                        var expectedPublicationDate = newPublicationDate.ToShortDateString();
                        var actualPublicationDate   = book.PublishDate.ToShortDateString();

                        Assert.Equal(expectedPublicationDate, actualPublicationDate);

                        //Update BookID
                        Console.Write("New ID: ");

                        var newID = Console.ReadLine();

                        book.UpdateID(newID);

                        //Update Author method
                        Console.Write("New Author: ");

                        var newAuthor = Console.ReadLine();

                        book.UpdateAuthor(newAuthor);

                    
        }