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"); }
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"); }
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"); }
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"); }
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"); }
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"); }
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"); }