public void GetCategory_WithIncorrectData_ShouldReturnCategory() { string errorMessagePrefix = "CategoryService GetCategory() method does not work properly."; var context = LibraaryDbContextInMemoryFactory.InitializeContext(); this.categoryService = new CategoryService(context); var category = this.categoryService.GetCategory("Fantasyss"); Assert.True(category == null, errorMessagePrefix); }
public void GetAllPublishersName_ShouldReturnAllPublishers() { string errorMessagePrefix = "PublisherService GetAllPublishersName() method does not work properly."; var context = LibraaryDbContextInMemoryFactory.InitializeContext(); this.publisherService = new PublisherService(context); LibraaryDbContextInMemoryFactory.SeedDb(context); var publishers = this.publisherService.GetAllPublishersName(); Assert.True(publishers.Count() != 0, errorMessagePrefix); }
public void GetAllByLibraryId_WithInCorrectData_ShouldReturnNull() { string errorMessagePrefix = "PublisherService GetAllByLibraryId() method does not work properly."; var context = LibraaryDbContextInMemoryFactory.InitializeContext(); this.publisherService = new PublisherService(context); var publishers = this.publisherService.GetAllByLibraryId("teest"); Assert.True(publishers.Count() == 0, errorMessagePrefix); }
public void GetPublisher_WithIncorrectData_ShouldReturnNull() { string errorMessagePrefix = "PublisherService GetAllPublishersName() method does not work properly."; var context = LibraaryDbContextInMemoryFactory.InitializeContext(); this.publisherService = new PublisherService(context); var publisher = this.publisherService.GetPublisher("Test"); Assert.True(publisher == null, errorMessagePrefix); }
public void GetCategories_ShouldReturnAllCategories() { string errorMessagePrefix = "CategoryService GetCategories() method does not work properly."; var context = LibraaryDbContextInMemoryFactory.InitializeContext(); this.categoryService = new CategoryService(context); LibraaryDbContextInMemoryFactory.SeedDb(context); var categories = this.categoryService.GetCategories(); Assert.True(categories.Count() != 0, errorMessagePrefix); }
public void GetAuthorByFullName_WithIncorrectData_ShouldReturnNull() { string errorMessagePrefix = "AuthorService GetAuthorByFullName() method does not work properly."; var context = LibraaryDbContextInMemoryFactory.InitializeContext(); this.authorService = new AuthorService(context); LibraaryDbContextInMemoryFactory.SeedDb(context); var author = this.authorService.GetAuthorByFullName("Test Testo"); Assert.True(author == null, errorMessagePrefix); }
public void GetAllByLibraryId_WithCorrectData_ShouldReturnAllAuthors() { string errorMessagePrefix = "AuthorService GetAllByLibraryId() method does not work properly."; var context = LibraaryDbContextInMemoryFactory.InitializeContext(); this.authorService = new AuthorService(context); LibraaryDbContextInMemoryFactory.SeedDb(context); var id = LibraaryDbContextInMemoryFactory.GetLibraryId(context); var author = this.authorService.GetAllByLibraryId(id); Assert.True(author != null, errorMessagePrefix); }
public void AddPublisher_WithCorrectData_ShouldSuccessfullyAddPublisher() { string errorMessagePrefix = "PublisherService Add() method does not work properly."; var context = LibraaryDbContextInMemoryFactory.InitializeContext(); this.publisherService = new PublisherService(context); AddPublisherDTO publisherDto = new AddPublisherDTO() { Name = "Testt1", URLAddress = "https/facebook.com/" }; bool actualResult = this.publisherService.Add(publisherDto); Assert.True(actualResult, errorMessagePrefix); }
public void AddAuthor_WithCorrectData_ShouldSuccessfullyAddAuthor() { string errorMessagePrefix = "AuthorService Add() method does not work properly."; var context = LibraaryDbContextInMemoryFactory.InitializeContext(); this.authorService = new AuthorService(context); AddAuthorDTO author = new AddAuthorDTO() { FirstName = "Test1", LastName = "Testov", Nationality = "Test" }; bool actualResult = this.authorService.Add(author); Assert.True(actualResult, errorMessagePrefix); }
public void AddAuthor_WithAuthorWhichIsAlreadyInDb_ShouldNotAddAuthor() { string errorMessagePrefix = "AuthorService Add() method does not work properly."; var context = LibraaryDbContextInMemoryFactory.InitializeContext(); this.authorService = new AuthorService(context); LibraaryDbContextInMemoryFactory.SeedDb(context); AddAuthorDTO author = new AddAuthorDTO() { FirstName = "Test", LastName = "Testov", Nationality = "Test" }; bool actualResult = this.authorService.Add(author); Assert.True(!actualResult, errorMessagePrefix); }