Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
namespace XUnitTestProject
using Xunit;
public static class SwitchStatementMapper
// Don't judge me, it's only for educational purposes :)
public static bool Map(string str) => str switch
"true" => true,
_ => false,
public class SwitchStatementMapperTests
[InlineData("true", true)]
[InlineData("false", false)]
[InlineData("dummy", false)]
public void Map_ReturnsCorrectBool(string str, bool expectedValue)
// Act
var result = SwitchStatementMapper.Map(str);
Assert.Equal(expectedValue, result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment