forked from dotnet/corefx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for Microsoft.VisualBasic.CompilerServices.Conversions #1…
…4344
- Loading branch information
Oswald Maskens
committed
Feb 1, 2018
1 parent
dee052f
commit 7316066
Showing
2 changed files
with
43 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Linq; | ||
using Microsoft.VisualBasic.CompilerServices; | ||
using Xunit; | ||
|
||
namespace Microsoft.VisualBasic.Tests | ||
{ | ||
public class ConversionsTests | ||
{ | ||
[Theory] | ||
[InlineData("true", true)] | ||
[InlineData("false", false)] | ||
[InlineData("5", true)] | ||
[InlineData("0", false)] | ||
[InlineData("5.5", true)] | ||
[InlineData("0.0", false)] | ||
[InlineData("&h5", true)] | ||
[InlineData("&h0", false)] | ||
[InlineData("&o5", true)] | ||
[InlineData("&o0", false)] | ||
public void ToBoolean_String_ReturnsExpected(string str, bool expected) | ||
{ | ||
Assert.Equal(expected, Conversions.ToBoolean(str)); | ||
} | ||
|
||
[Theory] | ||
[InlineData("yes")] | ||
[InlineData("contoso")] | ||
public void ToBoolean_String_ThrowsOnInvalidFormat(string str) | ||
{ | ||
Assert.Throws<InvalidCastException>(() => Conversions.ToBoolean(str)); | ||
} | ||
|
||
} | ||
} |
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