Esempio n. 1
0
        public async Task Remove_Format()
        {
            var format = await FormatHelpers.CreateValidFormat();

            var repository = new FormatRepository(_fixture.Context);

            (await repository.ExistsAsync(format.Id)).Should().BeTrue();

            await FormatHelpers.RemoveFormat(format.Id);

            var sut = await repository.GetAsync(format.Id);

            await _fixture.Context.Entry(sut).ReloadAsync();

            (await repository.ExistsAsync(format.Id)).Should().BeFalse();
        }
        public static async Task<Format> CreateValidFormat()
        {
            var connectionString = ConnectivityService.GetConnectionString("TEMP");
            var context = new BookOrganizer2DbContext(connectionString);
            var repository = new FormatRepository(context);

            var formatService = new FormatService(repository);

            var command = new Commands.Create
            {
                Id = new FormatId(SequentialGuid.NewSequentialGuid()),
                Name = "paperback"
            };

            await formatService.Handle(command);
            return await repository.GetAsync(command.Id);
        }