Пример #1
0
        public void Name_Returns_AssemblyName()
        {
            // Arrange
            var part = new AssemblyPart(typeof(AssemblyPartTests).Assembly);

            // Act
            string name = part.Name;

            // Assert
            Assert.Equal("Alium.Core.Tests", name);
        }
Пример #2
0
        public void Assembly_Returns_Assembly()
        {
            // Arrange
            var assembly = typeof(AssemblyPartTests).Assembly;
            var part     = new AssemblyPart(assembly);

            // Act
            var partAssembly = part.Assembly;

            // Assert
            Assert.Equal(part.Assembly, partAssembly);
        }
Пример #3
0
        public void Types_Returns_DefinedTypes()
        {
            // Arrange
            var assembly = typeof(AssemblyPartTests).Assembly;
            var part     = new AssemblyPart(assembly);

            // Act
            var types = part.Types;

            // Assert
            Assert.Equal(assembly.DefinedTypes, types);
            Assert.NotSame(assembly.DefinedTypes, types);
        }
Пример #4
0
        public void GetReferencePaths_ReturnsEmptySequenceForDynamicAssembly()
        {
            // Assert
            var name     = new AssemblyName($"DynamicAssembly-{Guid.NewGuid()}");
            var assembly = AssemblyBuilder.DefineDynamicAssembly(name, AssemblyBuilderAccess.RunAndCollect);
            var part     = new AssemblyPart(assembly);

            // Act
            var references = part.GetReferencePaths().ToList();

            // Assert
            Assert.Empty(references);
        }
Пример #5
0
        public void GetReferencePaths_ReturnsAssemblyLocation_IfPreserveCompilationContextIsNotSet()
        {
            // Arrange
            var assembly = typeof(AssemblyPart).Assembly;
            var part     = new AssemblyPart(assembly);

            // Act
            var references = part.GetReferencePaths().ToList();

            // Assert
            var actual = Assert.Single(references);

            Assert.Equal(assembly.Location, actual);
        }