Skip to content

Instantly share code, notes, and snippets.

View alefcarlos's full-sized avatar
✌️
Focusing

Alef Carlos alefcarlos

✌️
Focusing
View GitHub Profile
[Theory]
[InlineData(3, 3)]
[InlineData(3, 6)]
[InlineData(3, 9)]
[InlineData(5, 5)]
[InlineData(5, 10)]
[InlineData(5, 15)]
public void Multiple_ShouldSuccess(int y, int x)
{
Helpers.IsMultipleOf(y, x).ShouldBeTrue();
[Fact]
public void MultpleOf_ShouldThrowExpcetion()
{
Should.Throw<ArgumentException>(() =>
{
Helpers.IsMultipleOf(0, 3);
});
}
/// <summary>
/// Validadtes if a value is multiple of other number
/// </summary>
/// <param name="y">The desired multiple.</param>
/// <param name="x">Value to check.</param>
/// <returns>Returns true if value is multiple of multiple</returns>
public static bool IsMultipleOf(int y, int x)
{
//Check possible DivisionByZero
if (y == 0)
using Shouldly;
using Xunit;
namespace Problems.Tests
{
public class HelpersTess
{
[Fact]
public void Sum_ShouldBeSuccess()
{
@alefcarlos
alefcarlos / HelpersTest.cs
Created January 7, 2019 21:26
Test without Shouldly
using Xunit;
namespace Problems.Tests
{
public class HelpersTess
{
[Fact]
public void Sum_ShouldBeSuccess()
{
// Helpers.Sum(1, 2).ShouldBe(3);
@alefcarlos
alefcarlos / HelpersTest.cs
Created January 7, 2019 21:15
Using [Fact] attribute with xUnit
using Shouldly;
using Xunit;
namespace Problems.Tests
{
public class HelpersTess
{
[Fact]
public void Sum_ShouldBeSuccess()
{
namespace Problems
{
public static class Helpers
{
/// <summary>
/// Sums two numbers.
/// </summary>
/// <param name="a">First number.</param>
/// <param name="b">Second number.</param>
/// <returns>Returns the sum of two specified integer numbers.</returns>