コード例 #1
0
        public void Clone_CopiesAllPropertyValuesFromSource()
        {
            // Arrange
            var credentials = new PackageSourceCredential("SourceName", "username", "password", isPasswordClearText: false, validAuthenticationTypesText: null);
            var source      = new PackageSource("Source", "SourceName", isEnabled: false)
            {
                Credentials     = credentials,
                ProtocolVersion = 43
            };

            // Act
            var result = source.Clone();

            // Assert

            // source data
            Assert.Equal(source.Source, result.Source);
            Assert.Equal(source.Name, result.Name);
            Assert.Equal(source.IsEnabled, result.IsEnabled);
            Assert.Equal(source.ProtocolVersion, result.ProtocolVersion);

            // source credential
            result.Credentials.Should().NotBeNull();
            result.Credentials.Source.ShouldBeEquivalentTo(source.Credentials.Source);
            result.Credentials.Username.ShouldBeEquivalentTo(source.Credentials.Username);
            result.Credentials.IsPasswordClearText.ShouldBeEquivalentTo(source.Credentials.IsPasswordClearText);
        }
コード例 #2
0
        public void Clone_CopiesAllPropertyValuesFromSource()
        {
            // Arrange
            var credentials = new PackageSourceCredential("SourceName", "username", "password", isPasswordClearText: false);
            var source      = new PackageSource("Source", "SourceName", isEnabled: false)
            {
                Credentials     = credentials,
                ProtocolVersion = 43
            };

            // Act
            var result = source.Clone();

            // Assert
            Assert.Equal(source.Source, result.Source);
            Assert.Equal(source.Name, result.Name);
            Assert.Equal(source.IsEnabled, result.IsEnabled);
            Assert.Equal(source.ProtocolVersion, result.ProtocolVersion);
            Assert.Same(source.Credentials, result.Credentials);
        }
コード例 #3
0
ファイル: PackageSourceTest.cs プロジェクト: anthrax3/NuGet3
        public void Clone_CopiesAllPropertyValuesFromSource()
        {
            // Arrange
            var source = new PackageSource("Source", "SourceName", isEnabled: false)
            {
                IsPasswordClearText = true,
                Password            = "******",
                UserName            = "******",
                ProtocolVersion     = 43,
            };

            // Act
            var result = source.Clone();

            // Assert
            Assert.Equal(source.Source, result.Source);
            Assert.Equal(source.Name, result.Name);
            Assert.Equal(source.IsEnabled, result.IsEnabled);
            Assert.Equal(source.ProtocolVersion, result.ProtocolVersion);
            Assert.Equal(source.UserName, result.UserName);
            Assert.Equal(source.Password, source.Password);
        }