コード例 #1
0
        public async Task GetSecureConnectionStringTest()
        {
            string paramvalue = "TopSecretPassword";

            A.CallTo(() => _parameterStoreRequest.GetParameterValue(A <string> ._)).Returns(Task.FromResult(paramvalue));

            var connectionString = await _connectionInfoAsync.GetConnectionStringAsync();

            Assert.That(connectionString, Is.EqualTo(_connectionStringWithPassword));
        }
コード例 #2
0
        public async Task <string> GetConnectionStringAsync()
        {
            if (ShouldAppendString(_connectionString))
            {
                string username = GetDatabaseUsername(_connectionString);
                string password = await _parameterStoreRequest.GetParameterValue(username);

                StringBuilder sb = new StringBuilder(_connectionString);
                sb.Append(StringToReplace).Append(password).Append(";");

                return(sb.ToString());
            }
            return(_connectionString);
        }