// Test for Changing a title public void ChangeTitle(string bookTitle) { //arrange var book1 = new BookTest() { ID = 1, Title = "Domain Driven Design", Author = new Author() { Id = 65, Name = "Eric Evans" }, PublishDate = DateTime.Now.AddMonths(-6), Publisher = "McGraw-Hill" }; //act var newTitle = "Avengers: Infinity War"; book1.ChangeTitle(newTitle); //assert var expectedTitle = newTitle; var actualTitle = book1.Title; AssemblyLoadEventArgs.Equals(expectedTitle, actualTitle); }
// Test for Changing a title public void ChangePublisher(string pubName) { //arrange var book2 = new BookTest() { ID = 1, Title = "Visual Studio Guide", Author = new Author() { Id = 65, Name = "Eric Evans" }, PublishDate = DateTime.Now.AddMonths(-6), Publisher = "McGraw-Hill" }; //act var newPublisher = "Pearson"; book2.ChangePublisher(newPublisher); //assert var expectedPublisher = newPublisher; var actualPublisher = book2.Publisher; AssemblyLoadEventArgs.Equals(expectedPublisher, actualPublisher); }
public void ChangePublisher() { //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 newPublishername = "Stellar"; book.ChangePublisher(newPublishername); //Assert var NewPublisher = newPublishername; var CurrentPublisher = book.Publisher; AssemblyLoadEventArgs.Equals(NewPublisher, CurrentPublisher); }
public void ChangePublicationDate(DateTime dateTime) { //arrange var book = new BookTest() { 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(DateTime.Now.AddMonths(2)); //assert var expectedPublicationDate = newPublicationDate.ToShortDateString(); var actualPublicationDate = book.PublishDate.ToShortDateString(); AssemblyLoadEventArgs.Equals(expectedPublicationDate, actualPublicationDate); }
public async void ConvertBitcoins_BitcoinsAPIServiceUnavailible_ReturnsNegativeOne() { //Given var handlerMock = new Mock <HttpMessageHandler>(); var response = new HttpResponseMessage { StatusCode = HttpStatusCode.ServiceUnavailable, Content = new StringContent("not working") }; handlerMock .Protected() .Setup <Task <HttpResponseMessage> >( "SendAsync", ItExpr.IsAny <HttpRequestMessage>(), ItExpr.IsAny <CancellationToken>() ) .ReturnsAsync(response); var httpClient = new HttpClient(handlerMock.Object); var converter = new ConverterSvc(httpClient); //When var amount = await converter.ConvertBitcoins(ConverterSvc.Currency.USD, 5); //Then var expected = -1; AssemblyLoadEventArgs.Equals(expected, amount); }
public void CanSetNameFromReference() { var book1 = GetBook("Book 1"); SetName(book1, "New Name"); AssemblyLoadEventArgs.Equals("New Name", book1.Name); }
public void WhenTrailingSpaces_ShouldSucceed_2() { string input = "i live in a house "; string actualOutput = Program.reverseWords(input); string expectedOutput = " house a in live i"; AssemblyLoadEventArgs.Equals(actualOutput, expectedOutput); }
public void WriteLogDeleageCantPointToMethod() { WriteLogDelegate log = ReturnMessage; //points to return message and can point to more than one method log += ReturnMessage; log += IncrementCount; var result = log("Hello"); Assert.Equal("Hello", result); AssemblyLoadEventArgs.Equals(3, count); }
public void TestAdding2Plus2() { //arrange double a = 2; double b = 2; double expected = 4; var calc = new Calculator(); //act double actual = calc.Add(a, b); //assert AssemblyLoadEventArgs.Equals(expected, actual); }
public void ChangeAuthorName() { //Arrange var Author = new Author() { Id = 65, Name = "Eric Evans" }; //Act var newPenname = "The Big E"; Author.ChangeAuthorName(newPenname); //Assert var NewPen = newPenname; var CurrentAuthorName = Author.Name; AssemblyLoadEventArgs.Equals(NewPen, CurrentAuthorName); }
public void GetDefaultLanguage_ThisIsAFakeTest_ItShouldNotBeRun() { AssemblyLoadEventArgs.Equals(1, 1); }