Permalink
Browse files

Fix two credentials related unit tests

  • Loading branch information...
davidebbo committed Aug 24, 2017
1 parent 8dac71c commit 6b91936f8c4dfd6bb1f962a4717f05ba5bc3a50e
Showing with 19 additions and 14 deletions.
  1. +19 −14 Kudu.SiteManagement.Test/Configuration/KuduConfigurationFacts.cs
@@ -2,12 +2,11 @@
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using Kudu.Client.Infrastructure;
using Kudu.SiteManagement.Configuration;
using Kudu.SiteManagement.Configuration.Section;
using Kudu.SiteManagement.Configuration.Section.Cert;
using Kudu.SiteManagement.Test.Configuration.Fakes;
using Xunit;
@@ -16,22 +15,28 @@ namespace Kudu.SiteManagement.Test.Configuration
public class KuduConfigurationFacts
{
[Fact]
public void BasicAuthCredential_NoConfiguration_ReturnDefaultCredential( ) {
var appSettingsFake = new NameValueCollection( );
public void BasicAuthCredential_NoConfiguration_ReturnDefaultCredential()
{
var appSettingsFake = new NameValueCollection();
IKuduConfiguration config = CreateConfiguration( null , appSettingsFake );
var defaultCredential = new System.Net.NetworkCredential( "admin" , "kudu" );
Assert.Equal( defaultCredential , config.BasicAuthCredential.GetCredentials( ) );
IKuduConfiguration config = CreateConfiguration(null, appSettingsFake);
var defaultCredential = new NetworkCredential("admin", "kudu");
var configCredentials = (NetworkCredential)config.BasicAuthCredential.GetCredentials();
Assert.Equal(defaultCredential.UserName, configCredentials.UserName);
Assert.Equal(defaultCredential.Password, configCredentials.Password);
}
[Fact]
public void BasicAuthCredential_WithConfigurationSection_ReturnBasicAuthCredentialProvider( ) {
var configFake = new KuduConfigurationSectionFake( );
configFake.SetFake( "basicAuth" , BasicAuthConfigurationElementFake.Fake( "testingUser" , "testingPw" ) );
public void BasicAuthCredential_WithConfigurationSection_ReturnBasicAuthCredentialProvider()
{
var configFake = new KuduConfigurationSectionFake();
configFake.SetFake("basicAuth", BasicAuthConfigurationElementFake.Fake("testingUser", "testingPw"));
IKuduConfiguration config = CreateConfiguration( configFake , new NameValueCollection( ) );
var testingCredential = new System.Net.NetworkCredential( "testingUser" , "testingPw" );
Assert.Equal( testingCredential , config.BasicAuthCredential.GetCredentials( ) );
IKuduConfiguration config = CreateConfiguration(configFake, new NameValueCollection());
var testingCredential = new NetworkCredential("testingUser", "testingPw");
var configCredentials = (NetworkCredential)config.BasicAuthCredential.GetCredentials();
Assert.Equal(testingCredential.UserName, configCredentials.UserName);
Assert.Equal(testingCredential.Password, configCredentials.Password);
}
[Fact]

0 comments on commit 6b91936

Please sign in to comment.