Last active
August 29, 2015 14:02
-
-
Save MikeMKH/76c182ea01816227d0c8 to your computer and use it in GitHub Desktop.
FizzBuzz kata using C# with SpecFlow and FsCheck using 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
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"; | |
return string.IsNullOrEmpty(result) ? value.ToString() : result; | |
} | |
} | |
} |
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: FizzBuzzerSpec | |
I want to be able to translate numbers to their FizzBuzz value | |
In order to be able to communicate with the FizzBuzzons | |
As a Starfleet Captain | |
Scenario: 2 must translate to the string 2 | |
Given a FizzBuzzer | |
And the value of '2' | |
When translate is invoked | |
Then the result should be '2' | |
Scenario: 3 must translate to the string Fizz | |
Given a FizzBuzzer | |
And the value of '3' | |
When translate is invoked | |
Then the result should be 'Fizz' | |
Scenario: 5 must translate to the string Buzz | |
Given a FizzBuzzer | |
And the value of '5' | |
When translate is invoked | |
Then the result should be 'Buzz' | |
Scenario: 15 must translate to the string FizzBuzz | |
Given a FizzBuzzer | |
And the value of '15' | |
When translate is invoked | |
Then the result should be 'FizzBuzz' | |
Scenario Outline: FizzBuzz translation | |
Given a FizzBuzzer | |
And the value of '<value>' | |
When translate is invoked | |
Then the result should be '<expected value>' | |
Examples: | |
| value | expected value | | |
| 2 | 2 | | |
| 4 | 4 | | |
| 3 | Fizz | | |
| 9 | Fizz | | |
| 5 | Buzz | | |
| 25 | Buzz | | |
| 15 | FizzBuzz | | |
| 30 | FizzBuzz | |
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
// ------------------------------------------------------------------------------ | |
// <auto-generated> | |
// This code was generated by SpecFlow (http://www.specflow.org/). | |
// SpecFlow Version:1.9.0.77 | |
// SpecFlow Generator Version:1.9.0.0 | |
// Runtime Version:4.0.30319.18408 | |
// | |
// Changes to this file may cause incorrect behavior and will be lost if | |
// the code is regenerated. | |
// </auto-generated> | |
// ------------------------------------------------------------------------------ | |
#region Designer generated code | |
#pragma warning disable | |
namespace FizzBuzzSpec | |
{ | |
using TechTalk.SpecFlow; | |
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.9.0.77")] | |
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | |
[NUnit.Framework.TestFixtureAttribute()] | |
[NUnit.Framework.DescriptionAttribute("FizzBuzzerSpec")] | |
public partial class FizzBuzzerSpecFeature | |
{ | |
private static TechTalk.SpecFlow.ITestRunner testRunner; | |
#line 1 "FizzBuzzerSpec.feature" | |
#line hidden | |
[NUnit.Framework.TestFixtureSetUpAttribute()] | |
public virtual void FeatureSetup() | |
{ | |
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); | |
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "FizzBuzzerSpec", " I want to be able to translate numbers to their FizzBuzz value\nIn order to be a" + | |
"ble to communicate with the FizzBuzzons\nAs a Starfleet Captain", ProgrammingLanguage.CSharp, ((string[])(null))); | |
testRunner.OnFeatureStart(featureInfo); | |
} | |
[NUnit.Framework.TestFixtureTearDownAttribute()] | |
public virtual void FeatureTearDown() | |
{ | |
testRunner.OnFeatureEnd(); | |
testRunner = null; | |
} | |
[NUnit.Framework.SetUpAttribute()] | |
public virtual void TestInitialize() | |
{ | |
} | |
[NUnit.Framework.TearDownAttribute()] | |
public virtual void ScenarioTearDown() | |
{ | |
testRunner.OnScenarioEnd(); | |
} | |
public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo) | |
{ | |
testRunner.OnScenarioStart(scenarioInfo); | |
} | |
public virtual void ScenarioCleanup() | |
{ | |
testRunner.CollectScenarioErrors(); | |
} | |
[NUnit.Framework.TestAttribute()] | |
[NUnit.Framework.DescriptionAttribute("2 must translate to the string 2")] | |
public virtual void _2MustTranslateToTheString2() | |
{ | |
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("2 must translate to the string 2", ((string[])(null))); | |
#line 6 | |
this.ScenarioSetup(scenarioInfo); | |
#line 7 | |
testRunner.Given("a FizzBuzzer", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); | |
#line 8 | |
testRunner.And("the value of \'2\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); | |
#line 9 | |
testRunner.When("translate is invoked", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); | |
#line 10 | |
testRunner.Then("the result should be \'2\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); | |
#line hidden | |
this.ScenarioCleanup(); | |
} | |
[NUnit.Framework.TestAttribute()] | |
[NUnit.Framework.DescriptionAttribute("3 must translate to the string Fizz")] | |
public virtual void _3MustTranslateToTheStringFizz() | |
{ | |
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("3 must translate to the string Fizz", ((string[])(null))); | |
#line 12 | |
this.ScenarioSetup(scenarioInfo); | |
#line 13 | |
testRunner.Given("a FizzBuzzer", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); | |
#line 14 | |
testRunner.And("the value of \'3\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); | |
#line 15 | |
testRunner.When("translate is invoked", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); | |
#line 16 | |
testRunner.Then("the result should be \'Fizz\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); | |
#line hidden | |
this.ScenarioCleanup(); | |
} | |
[NUnit.Framework.TestAttribute()] | |
[NUnit.Framework.DescriptionAttribute("5 must translate to the string Buzz")] | |
public virtual void _5MustTranslateToTheStringBuzz() | |
{ | |
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("5 must translate to the string Buzz", ((string[])(null))); | |
#line 18 | |
this.ScenarioSetup(scenarioInfo); | |
#line 19 | |
testRunner.Given("a FizzBuzzer", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); | |
#line 20 | |
testRunner.And("the value of \'5\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); | |
#line 21 | |
testRunner.When("translate is invoked", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); | |
#line 22 | |
testRunner.Then("the result should be \'Buzz\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); | |
#line hidden | |
this.ScenarioCleanup(); | |
} | |
[NUnit.Framework.TestAttribute()] | |
[NUnit.Framework.DescriptionAttribute("15 must translate to the string FizzBuzz")] | |
public virtual void _15MustTranslateToTheStringFizzBuzz() | |
{ | |
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("15 must translate to the string FizzBuzz", ((string[])(null))); | |
#line 24 | |
this.ScenarioSetup(scenarioInfo); | |
#line 25 | |
testRunner.Given("a FizzBuzzer", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); | |
#line 26 | |
testRunner.And("the value of \'15\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); | |
#line 27 | |
testRunner.When("translate is invoked", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); | |
#line 28 | |
testRunner.Then("the result should be \'FizzBuzz\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); | |
#line hidden | |
this.ScenarioCleanup(); | |
} | |
[NUnit.Framework.TestAttribute()] | |
[NUnit.Framework.DescriptionAttribute("FizzBuzz translation")] | |
[NUnit.Framework.TestCaseAttribute("2", "2", null)] | |
[NUnit.Framework.TestCaseAttribute("4", "4", null)] | |
[NUnit.Framework.TestCaseAttribute("3", "Fizz", null)] | |
[NUnit.Framework.TestCaseAttribute("9", "Fizz", null)] | |
[NUnit.Framework.TestCaseAttribute("5", "Buzz", null)] | |
[NUnit.Framework.TestCaseAttribute("25", "Buzz", null)] | |
[NUnit.Framework.TestCaseAttribute("15", "FizzBuzz", null)] | |
[NUnit.Framework.TestCaseAttribute("30", "FizzBuzz", null)] | |
public virtual void FizzBuzzTranslation(string value, string expectedValue, string[] exampleTags) | |
{ | |
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("FizzBuzz translation", exampleTags); | |
#line 30 | |
this.ScenarioSetup(scenarioInfo); | |
#line 31 | |
testRunner.Given("a FizzBuzzer", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); | |
#line 32 | |
testRunner.And(string.Format("the value of \'{0}\'", value), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); | |
#line 33 | |
testRunner.When("translate is invoked", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); | |
#line 34 | |
testRunner.Then(string.Format("the result should be \'{0}\'", expectedValue), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); | |
#line hidden | |
this.ScenarioCleanup(); | |
} | |
} | |
} | |
#pragma warning restore | |
#endregion |
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 FizzBuzz; | |
using TechTalk.SpecFlow; | |
using NUnit.Framework; | |
namespace FizzBuzzSpec | |
{ | |
[Binding] | |
public class FizzBuzzerSpecSteps | |
{ | |
[Given(@"a FizzBuzzer")] | |
public void GivenAFizzBuzzer() | |
{ | |
ScenarioContext.Current.Add("FizzBuzzer", new FizzBuzzer()); | |
} | |
[Given(@"the value of '(.*)'")] | |
public void GivenTheValueOf(int value) | |
{ | |
ScenarioContext.Current.Add("value", value); | |
} | |
[When(@"translate is invoked")] | |
public void WhenTranslateIsInvoked() | |
{ | |
var fizzbuzzer = ScenarioContext.Current.Get<FizzBuzzer>("FizzBuzzer"); | |
var value = ScenarioContext.Current.Get<int>("value"); | |
ScenarioContext.Current.Add("actual", fizzbuzzer.Translate(value)); | |
} | |
[Then(@"the result should be '(.*)'")] | |
public void ThenTheResultShouldBe(string expected) | |
{ | |
var actual = ScenarioContext.Current.Get<string>("actual"); | |
Assert.That(expected, Is.EqualTo(actual)); | |
} | |
} | |
} |
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; | |
using FizzBuzz; | |
namespace FizzBuzzProperties | |
{ | |
[TestFixture] | |
public class FizzBuzzProperties | |
{ | |
private FizzBuzzer _fizzBuzzer; | |
[TestFixtureSetUp] | |
public void Setup() | |
{ | |
_fizzBuzzer = new FizzBuzzer(); | |
} | |
[TestCase] | |
public void Number_Divisible_By_3_Will_Return_Fizz() | |
{ | |
Spec.ForAny<int>(value => _fizzBuzzer.Translate(value).Equals("Fizz")) | |
.When(value => value % 3 == 0 && value % 5 != 0) | |
.QuickCheckThrowOnFailure(); | |
} | |
[TestCase] | |
public void Number_Divisible_By_5_Will_Return_Buzz() | |
{ | |
Spec.ForAny<int>(value => _fizzBuzzer.Translate(value).Equals("Buzz")) | |
.When(value => value % 3 != 0 && value % 5 == 0) | |
.QuickCheckThrowOnFailure(); | |
} | |
[TestCase] | |
public void Number_Divisible_By_15_Will_Return_FizzBuzz() | |
{ | |
Spec.ForAny<int>(value => _fizzBuzzer.Translate(value).Equals("FizzBuzz")) | |
.Or(value => value % 15 != 0) | |
.QuickCheckThrowOnFailure(); | |
} | |
class FizzBuzzModel | |
{ | |
public static string Translate(int value) | |
{ | |
if (value % 15 == 0) return "FizzBuzz"; | |
if (value % 3 == 0) return "Fizz"; | |
if (value % 5 == 0) return "Buzz"; | |
return value.ToString(CultureInfo.InvariantCulture); | |
} | |
} | |
[TestCase] | |
public void Will_Match_Model() | |
{ | |
Spec.ForAny<int>(value => | |
FizzBuzzModel.Translate(value).Equals(_fizzBuzzer.Translate(value))) | |
.QuickCheckThrowOnFailure(); | |
} | |
[TestCase] | |
public void Every_Number_Divisible_By_3_Contains_Fizz() | |
{ | |
Spec.ForAny<int>(x => true) | |
.Label("result must contain Fizz") | |
.And(x => _fizzBuzzer.Translate(x).Contains("Fizz")) | |
.When(x => x % 3 == 0) | |
.QuickCheckThrowOnFailure(); | |
} | |
[TestCase] | |
public void Every_Number_Divisible_By_5_Contains_Buzz() | |
{ | |
Spec.ForAny<int>(x => true) | |
.Label("result must contain Buzz") | |
.And(x => _fizzBuzzer.Translate(x).Contains("Buzz")) | |
.When(x => x % 5 == 0) | |
.QuickCheckThrowOnFailure(); | |
} | |
[TestCase] | |
public void Every_Number_Not_Divisible_By_3_Does_Not_Contains_Fizz() | |
{ | |
var noThrees = | |
from number in Any.OfType<int>() | |
where number%3 != 0 | |
select number; | |
Spec.For(noThrees, x => _fizzBuzzer.Translate(x).Contains("Fizz") == false) | |
.QuickCheckThrowOnFailure(); | |
} | |
[TestCase] | |
public void Every_Number_Not_Divisible_By_5_Does_Not_Contains_Buzz() | |
{ | |
var noFives = | |
from number in Any.OfType<int>() | |
where number%5 != 0 | |
select number; | |
Spec.For(noFives, x => _fizzBuzzer.Translate(x).Contains("Buzz") == false) | |
.QuickCheckThrowOnFailure(); | |
} | |
[TestCase] | |
public void Every_Every_Number_Divisible_By_15_Must_Equal_FizzBuzz() | |
{ | |
var fifteens = | |
from number in Any.OfType<int>() | |
where number%15 == 0 | |
select number; | |
Spec.ForAny<int>(x => true) | |
.AndFor(fifteens, x => _fizzBuzzer.Translate(x).Equals("FizzBuzz")) | |
.QuickCheckThrowOnFailure(); | |
} | |
[TestCase] | |
public void Classify_Values() | |
{ | |
Spec.ForAny<int>(x => true) | |
.Classify(x => _fizzBuzzer.Translate(x).Equals("Fizz"), "Fizz") | |
.Classify(x => _fizzBuzzer.Translate(x).Equals("Buzz"), "Buzz") | |
.Classify(x => _fizzBuzzer.Translate(x).Equals("FizzBuzz"), "FizzBuzz") | |
.Classify(x => _fizzBuzzer.Translate(x) != string.Empty, "Other") | |
.QuickCheckThrowOnFailure(); | |
} | |
[TestCase] | |
public void Collect_Values() | |
{ | |
Spec.ForAny<int>(x => true) | |
.Collect(x => _fizzBuzzer.Translate(x)) | |
.QuickCheckThrowOnFailure(); | |
} | |
[TestCase] | |
public void Collect_Values_For_Negatives() | |
{ | |
Spec.ForAny<int>(x => true) | |
.When(x => x < 0) | |
.Collect(x => _fizzBuzzer.Translate(x)) | |
.QuickCheckThrowOnFailure(); | |
} | |
[TestCase] | |
public void Collect_Values_And_Make_Sure_We_Do_Not_Have_Empties() | |
{ | |
Spec.ForAny<int>(x => true) | |
.And(x => string.IsNullOrEmpty(_fizzBuzzer.Translate(x)) == false) | |
.Collect(x => _fizzBuzzer.Translate(x)) | |
.Check(new Configuration {MaxNbOfTest = 50000}); | |
} | |
} | |
} |
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
"FizzBuzzSpec\FizzBuzzSpec\FizzBuzzerSpecFeature\_15MustTranslateToTheStringFizzBuzz","Passed","00:00:00.183","(local)" | |
Given a FizzBuzzer | |
-> done: FizzBuzzerSpecSteps.GivenAFizzBuzzer() (0.0s) | |
And the value of '15' | |
-> done: FizzBuzzerSpecSteps.GivenTheValueOf(15) (0.0s) | |
When translate is invoked | |
-> done: FizzBuzzerSpecSteps.WhenTranslateIsInvoked() (0.0s) | |
Then the result should be 'FizzBuzz' | |
-> done: FizzBuzzerSpecSteps.ThenTheResultShouldBe("FizzBuzz") (0.0s) | |
"FizzBuzzSpec\FizzBuzzSpec\FizzBuzzerSpecFeature\_2MustTranslateToTheString2","Passed","00:00:00.000","(local)" | |
Given a FizzBuzzer | |
-> done: FizzBuzzerSpecSteps.GivenAFizzBuzzer() (0.0s) | |
And the value of '2' | |
-> done: FizzBuzzerSpecSteps.GivenTheValueOf(2) (0.0s) | |
When translate is invoked | |
-> done: FizzBuzzerSpecSteps.WhenTranslateIsInvoked() (0.0s) | |
Then the result should be '2' | |
-> done: FizzBuzzerSpecSteps.ThenTheResultShouldBe("2") (0.0s) | |
"FizzBuzzSpec\FizzBuzzSpec\FizzBuzzerSpecFeature\_3MustTranslateToTheStringFizz","Passed","00:00:00.000","(local)" | |
Given a FizzBuzzer | |
-> done: FizzBuzzerSpecSteps.GivenAFizzBuzzer() (0.0s) | |
And the value of '3' | |
-> done: FizzBuzzerSpecSteps.GivenTheValueOf(3) (0.0s) | |
When translate is invoked | |
-> done: FizzBuzzerSpecSteps.WhenTranslateIsInvoked() (0.0s) | |
Then the result should be 'Fizz' | |
-> done: FizzBuzzerSpecSteps.ThenTheResultShouldBe("Fizz") (0.0s) | |
"FizzBuzzSpec\FizzBuzzSpec\FizzBuzzerSpecFeature\_5MustTranslateToTheStringBuzz","Passed","00:00:00.000","(local)" | |
Given a FizzBuzzer | |
-> done: FizzBuzzerSpecSteps.GivenAFizzBuzzer() (0.0s) | |
And the value of '5' | |
-> done: FizzBuzzerSpecSteps.GivenTheValueOf(5) (0.0s) | |
When translate is invoked | |
-> done: FizzBuzzerSpecSteps.WhenTranslateIsInvoked() (0.0s) | |
Then the result should be 'Buzz' | |
-> done: FizzBuzzerSpecSteps.ThenTheResultShouldBe("Buzz") (0.0s) | |
"FizzBuzzSpec\FizzBuzzSpec\FizzBuzzerSpecFeature\FizzBuzzTranslation(""15"",""FizzBuzz"",null)","Passed","00:00:00.000","(local)" | |
Given a FizzBuzzer | |
-> done: FizzBuzzerSpecSteps.GivenAFizzBuzzer() (0.0s) | |
And the value of '15' | |
-> done: FizzBuzzerSpecSteps.GivenTheValueOf(15) (0.0s) | |
When translate is invoked | |
-> done: FizzBuzzerSpecSteps.WhenTranslateIsInvoked() (0.0s) | |
Then the result should be 'FizzBuzz' | |
-> done: FizzBuzzerSpecSteps.ThenTheResultShouldBe("FizzBuzz") (0.0s) | |
"FizzBuzzSpec\FizzBuzzSpec\FizzBuzzerSpecFeature\FizzBuzzTranslation(""2"",""2"",null)","Passed","00:00:00.000","(local)" | |
Given a FizzBuzzer | |
-> done: FizzBuzzerSpecSteps.GivenAFizzBuzzer() (0.0s) | |
And the value of '2' | |
-> done: FizzBuzzerSpecSteps.GivenTheValueOf(2) (0.0s) | |
When translate is invoked | |
-> done: FizzBuzzerSpecSteps.WhenTranslateIsInvoked() (0.0s) | |
Then the result should be '2' | |
-> done: FizzBuzzerSpecSteps.ThenTheResultShouldBe("2") (0.0s) | |
"FizzBuzzSpec\FizzBuzzSpec\FizzBuzzerSpecFeature\FizzBuzzTranslation(""25"",""Buzz"",null)","Passed","00:00:00.000","(local)" | |
Given a FizzBuzzer | |
-> done: FizzBuzzerSpecSteps.GivenAFizzBuzzer() (0.0s) | |
And the value of '25' | |
-> done: FizzBuzzerSpecSteps.GivenTheValueOf(25) (0.0s) | |
When translate is invoked | |
-> done: FizzBuzzerSpecSteps.WhenTranslateIsInvoked() (0.0s) | |
Then the result should be 'Buzz' | |
-> done: FizzBuzzerSpecSteps.ThenTheResultShouldBe("Buzz") (0.0s) | |
"FizzBuzzSpec\FizzBuzzSpec\FizzBuzzerSpecFeature\FizzBuzzTranslation(""3"",""Fizz"",null)","Passed","00:00:00.000","(local)" | |
Given a FizzBuzzer | |
-> done: FizzBuzzerSpecSteps.GivenAFizzBuzzer() (0.0s) | |
And the value of '3' | |
-> done: FizzBuzzerSpecSteps.GivenTheValueOf(3) (0.0s) | |
When translate is invoked | |
-> done: FizzBuzzerSpecSteps.WhenTranslateIsInvoked() (0.0s) | |
Then the result should be 'Fizz' | |
-> done: FizzBuzzerSpecSteps.ThenTheResultShouldBe("Fizz") (0.0s) | |
"FizzBuzzSpec\FizzBuzzSpec\FizzBuzzerSpecFeature\FizzBuzzTranslation(""30"",""FizzBuzz"",null)","Passed","00:00:00.000","(local)" | |
Given a FizzBuzzer | |
-> done: FizzBuzzerSpecSteps.GivenAFizzBuzzer() (0.0s) | |
And the value of '30' | |
-> done: FizzBuzzerSpecSteps.GivenTheValueOf(30) (0.0s) | |
When translate is invoked | |
-> done: FizzBuzzerSpecSteps.WhenTranslateIsInvoked() (0.0s) | |
Then the result should be 'FizzBuzz' | |
-> done: FizzBuzzerSpecSteps.ThenTheResultShouldBe("FizzBuzz") (0.0s) | |
"FizzBuzzSpec\FizzBuzzSpec\FizzBuzzerSpecFeature\FizzBuzzTranslation(""4"",""4"",null)","Passed","00:00:00.000","(local)" | |
Given a FizzBuzzer | |
-> done: FizzBuzzerSpecSteps.GivenAFizzBuzzer() (0.0s) | |
And the value of '4' | |
-> done: FizzBuzzerSpecSteps.GivenTheValueOf(4) (0.0s) | |
When translate is invoked | |
-> done: FizzBuzzerSpecSteps.WhenTranslateIsInvoked() (0.0s) | |
Then the result should be '4' | |
-> done: FizzBuzzerSpecSteps.ThenTheResultShouldBe("4") (0.0s) | |
"FizzBuzzSpec\FizzBuzzSpec\FizzBuzzerSpecFeature\FizzBuzzTranslation(""5"",""Buzz"",null)","Passed","00:00:00.000","(local)" | |
Given a FizzBuzzer | |
-> done: FizzBuzzerSpecSteps.GivenAFizzBuzzer() (0.0s) | |
And the value of '5' | |
-> done: FizzBuzzerSpecSteps.GivenTheValueOf(5) (0.0s) | |
When translate is invoked | |
-> done: FizzBuzzerSpecSteps.WhenTranslateIsInvoked() (0.0s) | |
Then the result should be 'Buzz' | |
-> done: FizzBuzzerSpecSteps.ThenTheResultShouldBe("Buzz") (0.0s) | |
"FizzBuzzSpec\FizzBuzzSpec\FizzBuzzerSpecFeature\FizzBuzzTranslation(""9"",""Fizz"",null)","Passed","00:00:00.000","(local)" | |
Given a FizzBuzzer | |
-> done: FizzBuzzerSpecSteps.GivenAFizzBuzzer() (0.0s) | |
And the value of '9' | |
-> done: FizzBuzzerSpecSteps.GivenTheValueOf(9) (0.0s) | |
When translate is invoked | |
-> done: FizzBuzzerSpecSteps.WhenTranslateIsInvoked() (0.0s) | |
Then the result should be 'Fizz' | |
-> done: FizzBuzzerSpecSteps.ThenTheResultShouldBe("Fizz") (0.0s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For FsCheck:
These examples on the FsCheck github helped a lot!
https://github.com/fsharp/FsCheck/blob/master/examples/FsCheck.CSharpExamples/Program.cs
https://github.com/fsharp/FsCheck/blob/master/examples/FsCheck.MsTest.Examples/SampleTests.cs
https://github.com/fsharp/FsCheck/blob/master/docs/Documentation.md
I used this blog post as an example of using Any: http://bugsquash.blogspot.com/2014/02/generating-immutable-instances-in-c.html