コード例 #1
0
        public void RemoveFiles_ByIEnumerableFileData_NoException()
        {
            // Arrange
            List <FileData> files            = null;
            var             filesInfoProject = new PackageData(files);

            // Act
            filesInfoProject.RemoveFiles(files);

            filesInfoProject?.Dispose();
        }
コード例 #2
0
        public void AddFiles_ByIEnumerableFileData_AddNull_NoException()
        {
            // Arrange
            var             filesInfoProject = new PackageData();
            List <FileData> files            = null;

            // Act
            filesInfoProject.AddFiles(files);

            filesInfoProject?.Dispose();
        }
コード例 #3
0
        public void AddFile_AddNull_NoException()
        {
            // Arrange
            var      filesInfoProject = new PackageData();
            FileData file             = null;

            // Act
            filesInfoProject.AddFile(file);

            filesInfoProject?.Dispose();
        }
コード例 #4
0
        public void ClearFiles_CountNullResult()
        {
            // Arrange
            var files            = new List <FileData>(DefaultFileData.FileDataToTestTwoPositions);
            var filesInfoProject = new PackageData(files);

            // Act
            filesInfoProject.ClearFiles();

            // Assert
            Assert.AreEqual(filesInfoProject.FilesData.Count, 0);

            filesInfoProject?.Dispose();
        }
コード例 #5
0
        public void AddFiles_ByString_AddListWithNull_NoException()
        {
            // Arrange
            var           filesInfoProject = new PackageData();
            List <string> files            = new List <string>()
            {
                null
            };

            // Act
            filesInfoProject.AddFiles(files);

            filesInfoProject?.Dispose();
        }
コード例 #6
0
        public void AddFiles_ByIEnumerableFileData_AddTwoPositions()
        {
            // Arrange
            var filesInfoProject = new PackageData();
            var files            = new List <FileData>(DefaultFileData.FileDataToTestTwoPositions);

            // Act
            filesInfoProject.AddFiles(files);

            // Assert
            Assert.AreEqual(filesInfoProject.FilesData.Count, files.Count);
            Assert.AreSame(filesInfoProject.FilesData[filesInfoProject.FilesData.Count - 1], files.Last());

            filesInfoProject?.Dispose();
        }
コード例 #7
0
        public void AddFiles_ByString_Existing_AddsTwoOfFour_TotalFour()
        {
            // Arrange
            var files            = new List <FileData>(DefaultFileData.FileDataToTestTwoPositions);
            var filesInfoProject = new PackageData(files);
            var filesToAdd       = DefaultFileData.FileDataToTestFourPositions;

            // Act
            filesInfoProject.AddFiles(filesToAdd);

            // Assert
            Assert.AreEqual(filesInfoProject.FilesData.Count, 4);

            filesInfoProject?.Dispose();
        }
コード例 #8
0
        public void AddFile_AddOnePositions()
        {
            // Arrange
            var filesInfoProject = new PackageData();
            var file             = DefaultFileData.FileDataToTestTwoPositions[0];

            // Act
            filesInfoProject.AddFile(file);

            // Assert
            Assert.AreEqual(filesInfoProject.FilesData.Count, 1);
            Assert.AreSame(filesInfoProject.FilesData[filesInfoProject.FilesData.Count - 1], file);

            filesInfoProject?.Dispose();
        }
コード例 #9
0
        public void RemoveFiles_ByIEnumerableFileData_OnlyLastResult()
        {
            // Arrange
            var      files            = new List <FileData>(DefaultFileData.FileDataToTestThreePositions);
            var      filesInfoProject = new PackageData(files);
            var      filesToRemove    = new List <FileData>(DefaultFileData.FileDataToTestTwoPositions);
            FileData lastExpectedFile = DefaultFileData.FileDataToTestThreePositions[DefaultFileData.FileDataToTestThreePositions.Count - 1];

            // Act
            filesInfoProject.RemoveFiles(filesToRemove);

            // Assert
            Assert.AreEqual(filesInfoProject.FilesData.Count, 1);
            Assert.AreEqual(filesInfoProject.FilesData[DefaultFileData.FileDataToTestThreePositions.Count - 1], lastExpectedFile);

            filesInfoProject?.Dispose();
        }
コード例 #10
0
        public void AddFiles_ByString_AddTwoPositions()
        {
            // Arrange
            var filesInfoProject = new PackageData();
            var files            = new List <string>(DefaultFileData.FileDataToTestOnlyPath);

            // Act
            filesInfoProject.AddFiles(files);

            // Assert
            Assert.AreEqual(filesInfoProject.FilesData.Count, files.Count);

            var fileLast = filesInfoProject.FilesData[filesInfoProject.FilesData.Count - 1];

            Assert.AreEqual(fileLast.FileExtension, "Dgn");
            Assert.AreEqual(fileLast.FileName, "secondName");
            Assert.AreEqual(fileLast.FilePath, "C:\\folder\\secondName.Dgn");

            filesInfoProject?.Dispose();
        }
コード例 #11
0
        public void AddFiles_ByString_AddNull_NoException()
        {
            // Arrange
            var           filesInfoProject = new PackageData();
            List <string> files            = null;

            try
            {
                // Act
                filesInfoProject.AddFiles(files);
            }
            catch (Exception ex)
            {
                // Assert
                Assert.Fail("Ошибку необходимо игнорировать: " + ex.Message);
            }
            finally
            {
                filesInfoProject?.Dispose();
            }
        }