-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ISystemPrompts component and impl for Windows
Introduce the `ISystemPrompts` component which provides native/system UI prompts, starting with basic credential prompts. Include a basic implementation for Windows.
- Loading branch information
1 parent
21abaa0
commit 0b9bde1
Showing
13 changed files
with
559 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...shared/Microsoft.Git.CredentialManager.Tests/Interop/Windows/WindowsSystemPromptsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using Microsoft.Git.CredentialManager.Interop.Windows; | ||
using Microsoft.Git.CredentialManager.Tests.Objects; | ||
using Xunit; | ||
|
||
namespace Microsoft.Git.CredentialManager.Tests.Interop.Windows | ||
{ | ||
public class WindowsSystemPromptsTests | ||
{ | ||
[Fact] | ||
public void WindowsSystemPrompts_ShowCredentialPrompt_NullResource_ThrowsException() | ||
{ | ||
var sysPrompts = new WindowsSystemPrompts(); | ||
Assert.Throws<ArgumentNullException>(() => sysPrompts.ShowCredentialPrompt(null, null, out _)); | ||
} | ||
|
||
[Fact] | ||
public void WindowsSystemPrompts_ShowCredentialPrompt_EmptyResource_ThrowsException() | ||
{ | ||
var sysPrompts = new WindowsSystemPrompts(); | ||
Assert.Throws<ArgumentException>(() => sysPrompts.ShowCredentialPrompt(string.Empty, null, out _)); | ||
} | ||
|
||
[Fact] | ||
public void WindowsSystemPrompts_ShowCredentialPrompt_WhiteSpaceResource_ThrowsException() | ||
{ | ||
var sysPrompts = new WindowsSystemPrompts(); | ||
Assert.Throws<ArgumentException>(() => sysPrompts.ShowCredentialPrompt(" ", null, out _)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/shared/Microsoft.Git.CredentialManager/ISystemPrompts.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. | ||
|
||
namespace Microsoft.Git.CredentialManager | ||
{ | ||
public interface ISystemPrompts | ||
{ | ||
bool ShowCredentialPrompt(string resource, string userName, out ICredential credential); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/shared/Microsoft.Git.CredentialManager/Interop/MacOS/MacOSSystemPrompts.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. | ||
|
||
namespace Microsoft.Git.CredentialManager.Interop.MacOS | ||
{ | ||
public class MacOSSystemPrompts : ISystemPrompts | ||
{ | ||
public bool ShowCredentialPrompt(string resource, string userName, out ICredential credential) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
} | ||
} |
1 change: 0 additions & 1 deletion
1
src/shared/Microsoft.Git.CredentialManager/Interop/Windows/Native/Advapi32.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.