Beispiel #1
0
        public void Get_Plugins_Hash()
        {
            //Arrange
            var dir = PrepareFolder();
            var d1  = dir.CreateSubdirectory("1");
            var d2  = dir.CreateSubdirectory("2");
            var d3  = dir.CreateSubdirectory("3");
            var d4  = dir.CreateSubdirectory("4");
            var f1  = new FileInfo(Path.Combine(d1.FullName, "test1.dll"));
            var f2  = new FileInfo(Path.Combine(d1.FullName, "test2.dll"));
            var f3  = new FileInfo(Path.Combine(d2.FullName, "test1.dll"));
            var f4  = new FileInfo(Path.Combine(d2.FullName, "test2.dll"));
            var f5  = new FileInfo(Path.Combine(d3.FullName, "test1.dll"));
            var f6  = new FileInfo(Path.Combine(d3.FullName, "test2.dll"));
            var f7  = new FileInfo(Path.Combine(d4.FullName, "test1.dll"));

            f1.CreateText().Close();
            f2.CreateText().Close();
            f3.CreateText().Close();
            f4.CreateText().Close();
            f5.CreateText().Close();
            f6.CreateText().Close();
            f7.CreateText().Close();
            var list1 = new[] { f1, f2, f3, f4, f5, f6 };
            var list2 = new[] { f1, f3, f5 };
            var list3 = new[] { f1, f3, f5, f7 };

            //Act
            var hash1 = TypeLoader.GetFileHash(list1, new ProfilingLogger(Mock.Of <ILogger>(), Mock.Of <IProfiler>()));
            var hash2 = TypeLoader.GetFileHash(list2, new ProfilingLogger(Mock.Of <ILogger>(), Mock.Of <IProfiler>()));
            var hash3 = TypeLoader.GetFileHash(list3, new ProfilingLogger(Mock.Of <ILogger>(), Mock.Of <IProfiler>()));

            //Assert
            Assert.AreNotEqual(hash1, hash2);
            Assert.AreNotEqual(hash1, hash3);
            Assert.AreNotEqual(hash2, hash3);

            Assert.AreEqual(hash1, TypeLoader.GetFileHash(list1, new ProfilingLogger(Mock.Of <ILogger>(), Mock.Of <IProfiler>())));
        }