예제 #1
0
        public void PairShouldCorrectlyMergeSameFileInfos()
        {
            var          pcMock           = SetupBasicPairCreatorMock();
            var          infoComparerMock = SetupBasicInfoComparerMock();
            var          pairer           = new InfoPairer(pcMock.Object, infoComparerMock.Object);
            const string path             = "path";
            var          fileInfo1        = new FileInfoCollector.FileInformations()
            {
                FilePath = path, Hash = "hash1"
            };
            var fileInfo2 = new FileInfoCollector.FileInformations()
            {
                FilePath = path, Hash = "hash2"
            };
            List <FileInfoCollector.FileInformations> input1 = new List <FileInfoCollector.FileInformations>()
            {
                fileInfo1
            };
            List <FileInfoCollector.FileInformations> input2 = new List <FileInfoCollector.FileInformations>()
            {
                fileInfo2
            };;

            var result = pairer.Pair(input1, input2);

            Assert.IsInstanceOfType(result, typeof(List <InfoPair>));
            Assert.IsTrue(result.Count == 1);
            Assert.AreEqual(result[0].NewFileHash, fileInfo1.Hash);
            Assert.AreEqual(result[0].OldFileHash, fileInfo2.Hash);
        }
예제 #2
0
        public void PairShouldReturnNewListIfEmptyInputs()
        {
            var pcMock           = SetupBasicPairCreatorMock();
            var infoComparerMock = SetupBasicInfoComparerMock();
            var pairer           = new InfoPairer(pcMock.Object, infoComparerMock.Object);
            List <FileInfoCollector.FileInformations> input1 = new List <FileInfoCollector.FileInformations>();
            List <FileInfoCollector.FileInformations> input2 = new List <FileInfoCollector.FileInformations>();

            var result = pairer.Pair(input1, input2);

            Assert.IsInstanceOfType(result, typeof(List <InfoPair>));
            Assert.IsTrue(result.Count == 0);
        }
예제 #3
0
        public void PairShouldCorrectlyPairRightOnlyInput()
        {
            var pcMock           = SetupBasicPairCreatorMock();
            var infoComparerMock = SetupBasicInfoComparerMock();
            var pairer           = new InfoPairer(pcMock.Object, infoComparerMock.Object);
            var fileInfo         = new FileInfoCollector.FileInformations()
            {
                FilePath = "path", Hash = "hash"
            };
            List <FileInfoCollector.FileInformations> input1 = new List <FileInfoCollector.FileInformations>();
            List <FileInfoCollector.FileInformations> input2 = new List <FileInfoCollector.FileInformations>()
            {
                fileInfo
            };

            var result = pairer.Pair(input1, input2);

            Assert.IsInstanceOfType(result, typeof(List <InfoPair>));
            Assert.IsTrue(result.Count == 1);
            Assert.AreEqual(result[0].OldFileHash, fileInfo.Hash);
            Assert.AreEqual(result[0].NewFileHash, null);
        }