コード例 #1
0
        public void Store_Simple_FileContentWrited()
        {
            // Arrange
            var fileStorageProviderMock = new FileStorageProviderMock();
            var fileStorageManager = new FileStorageManager(fileStorageProviderMock);
            var content = CreateContent();
            content.Files.First().Stream = CreateInputStream("MockedFileData");

            // Act
            fileStorageManager.Store(content);

            // Assert
            fileStorageProviderMock.FileData.Should().Contain("MockedFileData");
        }
コード例 #2
0
        public void Store_PackagePropertyStatesNotOrdered_FilePathCombinedFromOrderedStates()
        {
            // Arrange
            var fileStorageProviderMock = new FileStorageProviderMock();
            var fileStorageManager = new FileStorageManager(fileStorageProviderMock);
            var content = CreateContent();
            content.PropertyStates = content.PropertyStates.Reverse().ToList();

            // Act
            fileStorageManager.Store(content);

            // Assert
            fileStorageProviderMock.Storage.Should().Contain(@"1_1\2_2\file1.txt");
        }
コード例 #3
0
        public void Store_NoPropertySpecified_FileContentWritedToRootDirectory()
        {
            // Arrange
            var fileStorageProviderMock = new FileStorageProviderMock();
            var fileStorageManager = new FileStorageManager(fileStorageProviderMock);
            var content = CreateContent();
            content.PropertyStates = new Collection<PropertyState>();

            // Act
            fileStorageManager.Store(content);

            // Assert
            fileStorageProviderMock.Storage.Should().Contain(@"file1.txt");
        }
コード例 #4
0
        public void Store_Simple_FilePathContainPropertyStateIndex()
        {
            // Arrange
            var fileStorageProviderMock = new FileStorageProviderMock();
            var fileStorageManager = new FileStorageManager(fileStorageProviderMock);
            var content = CreateContent();
            content.PropertyStates.Last().Index = 5;

            // Act
            fileStorageManager.Store(content);

            // Assert
            fileStorageProviderMock.Storage.Should().Contain(@"1_1\2_5\file2.txt");
        }
コード例 #5
0
        public void Store_ThereIsUnspecifiedPropertyInPackage_FilePathContainsDefaultNamedFolder()
        {
            // Arrange
            var fileStorageProviderMock = new FileStorageProviderMock();
            var fileStorageManager = new FileStorageManager(fileStorageProviderMock);
            var content = CreateContent();
            content.PropertyStates.Last().Property.Order = 3;

            // Act
            fileStorageManager.Store(content);

            // Assert
            fileStorageProviderMock.Storage.Should().Contain(@"1_1\-\2_2\file1.txt");
        }
コード例 #6
0
        public void Store_ThereIsTwoFilesInPackage_SecondFileSaved()
        {
            // Arrange
            var fileStorageProviderMock = new FileStorageProviderMock();
            var fileStorageManager = new FileStorageManager(fileStorageProviderMock);
            var content = CreateContent();

            // Act
            fileStorageManager.Store(content);

            // Assert
            fileStorageProviderMock.Storage.Should().Contain(@"1_1\2_2\file2.txt");
        }
コード例 #7
0
        public void Store_Simple_PackagePathInitialized()
        {
            // Arrange
            var fileStorageProviderMock = new FileStorageProviderMock();
            var fileStorageManager = new FileStorageManager(fileStorageProviderMock);
            var content = CreateContent();

            // Act
            fileStorageManager.Store(content);

            // Assert
            content.Path.Should().Be(@"1_1\2_2");
        }