-
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.
Merge pull request #92 from mjcheetham/basic-nativeui
Add ISystemPrompts component and impl for Windows
- Loading branch information
Showing
18 changed files
with
639 additions
and
17 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
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
28 changes: 28 additions & 0 deletions
28
src/shared/Microsoft.Git.CredentialManager/ConvertUtils.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,28 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. | ||
using System; | ||
|
||
namespace Microsoft.Git.CredentialManager | ||
{ | ||
public static class ConvertUtils | ||
{ | ||
public static bool TryToInt32(object value, out int i) | ||
{ | ||
return TryConvert(Convert.ToInt32, value, out i); | ||
} | ||
|
||
public static bool TryConvert<T>(Func<object, T> convert, object value, out T @out) | ||
{ | ||
try | ||
{ | ||
@out = convert(value); | ||
return true; | ||
} | ||
catch | ||
{ | ||
@out = default(T); | ||
return false; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.