Esempio n. 1
0
        public async void Upload_WithValidContentButInvalidFileName_MustReturnNull()
        {
            using (var sampleClone = new Helpers.SampleClone())
            {
                var service = new LocalDriveService();

                var directoryID = Path.GetDirectoryName(sampleClone.FilePath);
                var fileName    = "#,.*%";
                var value       = await service.Upload(directoryID, fileName, sampleClone.FileContent);

                Assert.Null(value);
            }
        }
        public async void Download_WithValidFile_MustReturnSpectedData()
        {
            using (var sampleClone = new Helpers.SampleClone())
            {
                var service = new LocalDriveService();

                sampleClone.WriteFile();
                var expectedValue = sampleClone.FileContent.Length;
                var value         = await service.Download(sampleClone.FilePath);

                Assert.Equal(expectedValue, value?.Length);
            }
        }
Esempio n. 3
0
        public async void Upload_WithValidExistingFile_MustReturnSpectedData()
        {
            using (var sampleClone = new Helpers.SampleClone())
            {
                var service = new LocalDriveService();

                sampleClone.WriteFile();
                var expectedValue = await service.GetDetails(sampleClone.FilePath);

                var value = await service.Upload(sampleClone.FilePath, sampleClone.FileContent);

                Assert.Equal(expectedValue?.SizeInBytes, value?.SizeInBytes);
            }
        }
Esempio n. 4
0
        public async void Upload_WithValidNonExistingFile_MustReturnSpectedData()
        {
            using (var sampleClone = new Helpers.SampleClone())
            {
                var service = new LocalDriveService();

                var directoryID = Path.GetDirectoryName(sampleClone.FilePath);
                var fileName    = Path.GetFileName(sampleClone.FilePath);
                var value       = await service.Upload(directoryID, fileName, sampleClone.FileContent);

                var expectedValue = await service.GetDetails($"{directoryID}{Path.DirectorySeparatorChar}{fileName}");

                Assert.Equal(expectedValue?.SizeInBytes, value?.SizeInBytes);
            }
        }