public async Task Remove_Publisher() { var publisher = await PublisherHelpers.CreateValidPublisher(); var repository = new PublisherRepository(_fixture.Context); (await repository.ExistsAsync(publisher.Id)).Should().BeTrue(); await PublisherHelpers.RemovePublisher(publisher.Id); var sut = await repository.GetAsync(publisher.Id); await _fixture.Context.Entry(sut).ReloadAsync(); (await repository.ExistsAsync(publisher.Id)).Should().BeFalse(); }
public static async Task <Publisher> CreateValidPublisher() { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new PublisherRepository(context); var publisherService = new PublisherService(repository); var command = new Commands.Create { Id = new PublisherId(SequentialGuid.NewSequentialGuid()), Name = "SubPop", LogoPath = @"\\filepath\file.jpg", Description = "Best books in the world!" }; await publisherService.Handle(command); return(await repository.GetAsync(command.Id)); }
public async Task Update_Publisher_LogoPath() { var publisher = await PublisherHelpers.CreateValidPublisher(); var repository = new PublisherRepository(_fixture.Context); (await repository.ExistsAsync(publisher.Id)).Should().BeTrue(); var sut = await repository.GetAsync(publisher.Id); var publisherId = sut.Id; sut.Should().NotBeNull(); sut.LogoPath.Should().Be(@"\\filepath\file.jpg"); await PublisherHelpers.UpdatePublisherLogoPath(sut.Id, @"\\filepath\newFile.jpg"); await _fixture.Context.Entry(sut).ReloadAsync(); sut.LogoPath.Should().Be(@"\\filepath\newFile.jpg"); sut.Id.Should().Be(publisherId); }
public async Task Update_Publisher_Name() { var publisher = await PublisherHelpers.CreateValidPublisher(); var repository = new PublisherRepository(_fixture.Context); (await repository.ExistsAsync(publisher.Id)).Should().BeTrue(); var sut = await repository.GetAsync(publisher.Id); var publisherId = sut.Id; sut.Should().NotBeNull(); sut.Name.Should().Be("SubPop"); await PublisherHelpers.UpdatePublisherName(sut.Id, "NewPop"); await _fixture.Context.Entry(sut).ReloadAsync(); sut.Name.Should().Be("NewPop"); sut.Id.Should().Be(publisherId); }
public async Task Update_Publisher_Description() { var publisher = await PublisherHelpers.CreateValidPublisher(); var repository = new PublisherRepository(_fixture.Context); (await repository.ExistsAsync(publisher.Id)).Should().BeTrue(); var sut = await repository.GetAsync(publisher.Id); var publisherId = sut.Id; sut.Should().NotBeNull(); sut.Description.Should().Contain("Best books in the world!"); await PublisherHelpers.UpdatePublisherDescription(sut.Id, "Bacon ipsum..."); await _fixture.Context.Entry(sut).ReloadAsync(); sut.Description.Should().Contain("Bacon ipsum"); sut.Id.Should().Be(publisherId); }