This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Globalization; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using NUnit.Framework; | |
using NUnit.Framework.Constraints; | |
namespace NUnit |
This file contains hidden or 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
import Test.HUnit | |
isLeapYear::Int->Bool | |
isLeapYear y | |
| mod y 400 == 0 = True | |
| mod y 100 == 0 = False | |
| mod y 4 == 0 = True | |
| otherwise = False | |
tests = TestList[TestCase $ assertEqual "4 is a leap year" True $ isLeapYear 4 |
This file contains hidden or 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
using NUnit.Framework; | |
namespace LeapYear | |
{ | |
public class LeapYearChecker | |
{ | |
public bool IsLeapYear(int year) | |
{ | |
if (year % 400 == 0) return true; | |
if (year % 100 == 0) return false; |
This file contains hidden or 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
package com.bigcompany.utils.test | |
import org.scalatest._ | |
object LeapYear { | |
def isLeapYear(year: Int) = (year % 4, year % 100, year % 400) match { | |
case (_, _, 0) => true | |
case (_, 0, _) => false | |
case (0, _, _) => true | |
case _ => false |
This file contains hidden or 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
namespace LeapYearChecker | |
open Xunit | |
open FsUnit.Xunit | |
module ``leap year kata`` = | |
let (|DivisibleBy|_|) by x = if x % by = 0 then Some DivisibleBy else None | |
let isLeapYear (year) = |
This file contains hidden or 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
Feature: FizzBuzz | |
As a Software Craftsman | |
I want to do the FizzBuzz kata | |
So that I can get better at my craft | |
Scenario Outline: Validate the functionality of FizzBuzz using the following | |
Given the follow input <value> | |
When FizzBuzz is invoked with the input <value> | |
Then the actual result will equal the <expected> |
This file contains hidden or 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
package com.kata.spec2 | |
import org.specs2._ | |
import matcher.DataTables | |
object FizzBuzzer { | |
class FizzBuzzExtractor[T](f: T => Boolean) { | |
def unapply(x: T) = f(x) | |
} |
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Globalization; | |
using System.Linq; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
using System.Threading.Tasks; | |
using FsCheck; | |
using NUnit.Framework; | |
using FsCheck.Fluent; |
This file contains hidden or 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
namespace FizzBuzz | |
{ | |
public class FizzBuzzer | |
{ | |
public string Translate(int value) | |
{ | |
var result = string.Empty; | |
if (value % 3 == 0) result += "Fizz"; | |
if (value % 5 == 0) result += "Buzz"; |
This file contains hidden or 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
using System.Text.RegularExpressions; | |
using FsCheck; | |
using FsCheck.Fluent; | |
using NUnit.Framework; | |
namespace FizzBuzz | |
{ | |
public class FizzBuzzer | |
{ | |
public string Translate(int value) |