diff --git a/products/ASC.Files/Tests/BaseFilesTests.cs b/products/ASC.Files/Tests/BaseFilesTests.cs index 74e491bb9b..16f923ed5f 100644 --- a/products/ASC.Files/Tests/BaseFilesTests.cs +++ b/products/ASC.Files/Tests/BaseFilesTests.cs @@ -67,7 +67,6 @@ class FilesApplication : WebApplicationFactory public class MySetUpClass { protected IServiceScope Scope { get; set; } - protected readonly string _pathToProducts = Path.Combine("..", "..", "..", "Data.Test"); [OneTimeSetUp] public void CreateDb() @@ -102,7 +101,7 @@ public class MySetUpClass try { - Directory.Delete(Path.Combine("..", "..", "..", _pathToProducts), true); + Directory.Delete(Path.Combine(Path.Combine("..", "..", "..", "..", "..", "..", "Data.Test")), true); } catch { } } diff --git a/products/ASC.Files/Tests/Infrastructure/DataTests.cs b/products/ASC.Files/Tests/Infrastructure/DataTests.cs index 954a422b98..365f46b7c4 100644 --- a/products/ASC.Files/Tests/Infrastructure/DataTests.cs +++ b/products/ASC.Files/Tests/Infrastructure/DataTests.cs @@ -81,8 +81,9 @@ public static class DataTests public const int RoomId = 18; public const int RoomIdForDelete = 19; public const int RoomIdForArchive = 20; - public const int RoomIdForUnarchive = 22; public const int RoomIdForUnpin = 21; + public const int RoomIdForUnarchive = 22; + public const int RoomIdWithTags = 24; public const string RoomLinkKey = "394892027511.N5UVJ8F6UJPGN0RZKWSOMEYVZVLTZLECGVHHSDSH7ZA"; public const string TagNames = "name1,name2"; diff --git a/products/ASC.Files/Tests/Rooms.cs b/products/ASC.Files/Tests/Rooms.cs index 276533e9b2..7854a4b255 100644 --- a/products/ASC.Files/Tests/Rooms.cs +++ b/products/ASC.Files/Tests/Rooms.cs @@ -126,17 +126,17 @@ public partial class BaseFilesTests public async Task AddTagsById(int id, string tagNames) { var folder = await PutAsync>($"rooms/{id}/tags", JsonContent.Create(new { Names = tagNames.Split(',') }), _options); - Assert.IsNotNull(folder.Tags.Count() == 2); + Assert.IsTrue(folder.Tags.Count() == 2); } - [TestCase(DataTests.RoomId, DataTests.TagNames)] + [TestCase(DataTests.RoomIdWithTags, DataTests.TagNames)] [Category("Room")] [Order(10)] [Description("delete - rooms/{id}/tags - delete tags by id")] public async Task DeleteTagsById(int id, string tagNames) { var folder = await DeleteAsync>($"rooms/{id}/tags", JsonContent.Create(new { Names = tagNames.Split(',') }), _options); - Assert.IsNotNull(folder.Tags.Count() == 0); + Assert.IsTrue(folder.Tags.Count() == 0); } [TestCase(DataTests.RoomId)] diff --git a/products/ASC.Files/Tests/TestMigrations/20210804110106_TestMigrationFiles.cs b/products/ASC.Files/Tests/TestMigrations/20210804110106_TestMigrationFiles.cs index 0b216986ff..22cc5f526b 100644 --- a/products/ASC.Files/Tests/TestMigrations/20210804110106_TestMigrationFiles.cs +++ b/products/ASC.Files/Tests/TestMigrations/20210804110106_TestMigrationFiles.cs @@ -336,6 +336,21 @@ public partial class TestFilesMigration : Migration columns: new[] { "folder_id", "parent_id", "level" }, values: new object[] { 23, 17, 0 }); + migrationBuilder.InsertData( + table: "files_folder", + columns: new[] { "id", "parent_id", "title", "folder_type", "create_by", "create_on", "modified_by", "modified_on", "tenant_id", "foldersCount", "filesCount" }, + values: new object[] { 24, 17, "Room_Title", 19, "66faa6e4-f133-11ea-b126-00ffeec8b4ef", new DateTime(2021, 8, 4, 11, 1, 4, 513, DateTimeKind.Utc).AddTicks(1842), "66faa6e4-f133-11ea-b126-00ffeec8b4ef", new DateTime(2021, 8, 4, 11, 1, 4, 513, DateTimeKind.Utc).AddTicks(1842), 1, 0, 0 }); + + migrationBuilder.InsertData( + table: "files_folder_tree", + columns: new[] { "folder_id", "parent_id", "level" }, + values: new object[] { 24, 24, 0 }); + + migrationBuilder.InsertData( + table: "files_folder_tree", + columns: new[] { "folder_id", "parent_id", "level" }, + values: new object[] { 24, 17, 0 }); + migrationBuilder.InsertData( table: "files_file", columns: new[] { @@ -441,6 +456,33 @@ public partial class TestFilesMigration : Migration 1, 1, "name1", "66faa6e4-f133-11ea-b126-00ffeec8b4ef", 64 }); + migrationBuilder.InsertData( + table: "files_tag_link", + columns: new[]{ + "tenant_id","tag_id","entry_type","entry_id","create_by","create_on","tag_count", + }, + values: new object[]{ + 1, 1, 1, "24", "66faa6e4-f133-11ea-b126-00ffeec8b4ef", new DateTime(2021, 8, 4, 11, 1, 4, 513, DateTimeKind.Utc).AddTicks(1842), 0 + }); + + migrationBuilder.InsertData( + table: "files_tag", + columns: new[]{ + "id","tenant_id","name","owner","flag", + }, + values: new object[]{ + 2, 1, "name2", "66faa6e4-f133-11ea-b126-00ffeec8b4ef", 64 + }); + + migrationBuilder.InsertData( + table: "files_tag_link", + columns: new[]{ + "tenant_id","tag_id","entry_type","entry_id","create_by","create_on","tag_count", + }, + values: new object[]{ + 1, 2, 1, "24", "66faa6e4-f133-11ea-b126-00ffeec8b4ef", new DateTime(2021, 8, 4, 11, 1, 4, 513, DateTimeKind.Utc).AddTicks(1842), 0 + }); + migrationBuilder.InsertData( table: "files_tag", columns: new[]{ @@ -449,6 +491,7 @@ public partial class TestFilesMigration : Migration values: new object[]{ 3, 1, "pin", "66faa6e4-f133-11ea-b126-00ffeec8b4ef", 128 }); + migrationBuilder.InsertData( table: "files_tag_link", columns: new[]{