diff --git a/src/Accounts/Accounts.Test/AutosaveTests.cs b/src/Accounts/Accounts.Test/AutosaveTests.cs index 7f8cc7e22837..32d1d9dd00a8 100644 --- a/src/Accounts/Accounts.Test/AutosaveTests.cs +++ b/src/Accounts/Accounts.Test/AutosaveTests.cs @@ -48,11 +48,11 @@ private void SetMockedAzKeyStore() var storageMocker = new Mock(); storageMocker.Setup(f => f.Create()).Returns(storageMocker.Object); storageMocker.Setup(f => f.ReadData()).Returns(new byte[0]); + storageMocker.Setup(f => f.WriteData(It.IsAny())).Callback((byte[] s) => {}); var keyStore = new AzKeyStore(AzureSession.Instance.ARMProfileDirectory, "keystore.cache", false, false, storageMocker.Object); AzKeyStore.RegisterJsonConverter(typeof(ServicePrincipalKey), typeof(ServicePrincipalKey).Name); AzKeyStore.RegisterJsonConverter(typeof(SecureString), typeof(SecureString).Name, new SecureStringConverter()); AzureSession.Instance.RegisterComponent(AzKeyStore.Name, () => keyStore); - keyStore.LoadStorage(); } void ResetState() diff --git a/src/Accounts/Authentication.Test/Mocks/MockServicePrincipalCredential.cs b/src/Accounts/Authentication.Test/Mocks/MockServicePrincipalCredential.cs deleted file mode 100644 index 3c932b604ee8..000000000000 --- a/src/Accounts/Authentication.Test/Mocks/MockServicePrincipalCredential.cs +++ /dev/null @@ -1,51 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System; -using System.Threading; -using System.Threading.Tasks; - -using Azure.Core; -using Azure.Identity; - -using Microsoft.Azure.PowerShell.Authenticators; -using Microsoft.PowerShell.Commands; - -namespace Microsoft.Azure.PowerShell.Authentication.Test.Mocks -{ - internal class MockClientSecretCredential : ClientSecretCredential - { - internal string ClientId { get; set; } - internal string TenantId { get; set; } - internal string ClientSecret { get; set; } - - internal TokenRequestContext TokenRequestContext { get; private set; } - - public Func TokenFactory { get; set; } - - public MockClientSecretCredential(string tenantId, string clientId, string clientSecret) - : base(tenantId, clientId, clientSecret) - { - ClientId = clientId; - TenantId = tenantId; - ClientSecret = clientSecret; - } - - public override ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default(CancellationToken)) - { - TokenRequestContext = requestContext; - return new ValueTask(TokenFactory()); - } - } -}