public void DeveRetornarTodosRegistros()
        {
            using (var context = new FileDbContext(GetDbContextOptions())) {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();
                var fileS3Repository = new FileS3Repository(context);

                List <FileS3> files = new List <FileS3>();
                files.Add(fileS3Repository.Add(GetNewRandomFileS3()));
                files.Add(fileS3Repository.Add(GetNewRandomFileS3()));
                files.Add(fileS3Repository.Add(GetNewRandomFileS3()));

                var fileS3Result = fileS3Repository.GetAll();

                Assert.NotNull(fileS3Result);
                Assert.Equal(files.Count, fileS3Result.Count);
            }
        }
        public void DeveSalvarComSucesso()
        {
            using (var context = new FileDbContext(GetDbContextOptions())) {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();
                var fileS3Repository = new FileS3Repository(context);
                var fileS3           = GetNewRandomFileS3();

                var fileS3Result = fileS3Repository.Add(fileS3);

                Assert.NotNull(fileS3Result);
            }
        }
        public void DeveRetornarArquivoPorId()
        {
            using (var context = new FileDbContext(GetDbContextOptions())) {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();
                var fileS3Repository = new FileS3Repository(context);
                var fileS3           = fileS3Repository.Add(GetNewRandomFileS3());

                var fileS3Result = fileS3Repository.GetById(fileS3.Id);

                Assert.NotNull(fileS3Result);
                Assert.Equal(fileS3.Id, fileS3Result.Id);
            }
        }
        public void DeveAtualizarArquivo()
        {
            using (var context = new FileDbContext(GetDbContextOptions())) {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();
                var    fileS3Repository = new FileS3Repository(context);
                var    fileS3           = fileS3Repository.Add(GetNewRandomFileS3());
                string newBucketName    = "new-bucket-name";
                string newFileName      = "new-filename.png";
                string mimeType         = "image/png";
                fileS3.SetBucketName(newBucketName);
                fileS3.SetFileName(newFileName);
                fileS3.SetFilePath(newFileName);
                fileS3.SetContentType(mimeType);

                var fileS3Result = fileS3Repository.Update(fileS3);

                Assert.NotNull(fileS3Result);
                Assert.Equal(newBucketName, fileS3Result.BucketName);
            }
        }