コード例 #1
0
        public void NotAValidPEFile()
        {
            // Arrange
            using var stream = new MemoryStream();

            // Act
            var strongNameInfo = StrongNameInfo.Get(stream) !;

            // Assert
            Assert.Null(strongNameInfo);
        }
コード例 #2
0
        public void ExtractInfoTest()
        {
            // Arrange
            var assembly     = typeof(StrongNameInfoTests).Assembly;
            var assemblyName = assembly.GetName();

            // Act
            using var stream = File.OpenRead(assembly.Location);
            var strongNameInfo = StrongNameInfo.Get(stream) !;

            // Assert
            Assert.NotNull(strongNameInfo);
            Assert.Equal(assemblyName.Name, strongNameInfo.Name);
            Assert.True(strongNameInfo.PublicKeyToken.HasValue);
            Assert.Equal(assemblyName.GetPublicKeyToken(), strongNameInfo.PublicKeyToken !.Value.Bytes.ToArray());
        }