Exemplo n.º 1
0
        private void ScanAssembliesForTypeInfo()
        {
            var files = Directory.GetFiles(_assemblySearchPatterns).ToList();

            _typeInfo = TypeInfoFactory.Get(files);
            RefreshActivityTypeList();
        }
        public void GivenInvalidAssemblyName_ReturnsEmptyList()
        {
            // Arrange

            // Act
            var results = TypeInfoFactory.Get(new[] { TestHelper.GetFullPath("InvalidAssembly.dll") });

            // Assert
            results.Should().NotBeNull().And.BeEmpty();
        }
        public void GivenAssembly_NotLoadedIntoCurrentAppDomain()
        {
            // Arrange
            var fullPath = TestHelper.GetFullPath("DummyAssembly.dll");

            // Act
            TypeInfoFactory.Get(new[] { fullPath });

            // Assert
            AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies().Any(x => x.FullName.Contains("DummyAssembly")).Should().BeFalse();
        }
        public void GivenAssembly_ReturnTypeInfo()
        {
            // Arrange
            var fullPath = TestHelper.GetFullPath("DummyAssembly.dll");

            // Act
            var results = TypeInfoFactory.Get(new[] { fullPath });

            // Assert
            results.Should().NotBeNull().And.Contain(x => x.FullName == "DummyAssembly.RuleSetContext" && x.FilePath == fullPath);
        }
        public void GivenAssembly_DoesNotLockFile()
        {
            // Arrange
            var dummyAssemblyPath = TestHelper.GetFullPath("DummyAssembly.dll");
            var assemblyToTest    = TestHelper.GetFullPath($"{Guid.NewGuid()}.dll");

            File.Copy(dummyAssemblyPath, assemblyToTest);

            // Act
            TypeInfoFactory.Get(new[] { assemblyToTest });

            // Assert
            File.Delete(assemblyToTest);
        }