public void TestOnPremDatasourceEncryptionSQLAuth()
{
SecureString secureString = new SecureString();
string expectedOutput = "My encrypted string " + Guid.NewGuid();
string linkedServiceType = "OnPremisesSqlLinkedService";
string nonCredentialValue = "Driver=mydriver;server=myserver";
string authenticationType = "Basic";
string serverName = null;
string databaseName = null;
var cmdlet = new NewAzureDataFactoryEncryptValueCommand
{
CommandRuntime = this.commandRuntimeMock.Object,
DataFactoryClient = this.dataFactoriesClientMock.Object,
Value = secureString,
ResourceGroupName = ResourceGroupName,
DataFactoryName = DataFactoryName,
GatewayName = GatewayName,
Type = linkedServiceType,
NonCredentialValue = nonCredentialValue,
AuthenticationType = authenticationType,
Server = serverName,
Database = databaseName
};
// Arrange
this.dataFactoriesClientMock.Setup(f => f.OnPremisesEncryptString(secureString, ResourceGroupName, DataFactoryName, GatewayName, null, linkedServiceType, nonCredentialValue, authenticationType, serverName, databaseName)).Returns(expectedOutput);
// Action
cmdlet.ExecuteCmdlet();
// Assert
this.dataFactoriesClientMock.Verify(f => f.OnPremisesEncryptString(secureString, ResourceGroupName, DataFactoryName, GatewayName, null, linkedServiceType, nonCredentialValue, authenticationType, serverName, databaseName), Times.Once());
this.commandRuntimeMock.Verify(f => f.WriteObject(expectedOutput), Times.Once());
}