public void Initialize() { var fizzSpec = new FizzSpecification(); var buzzSpec = new BuzzSpecification(); _fizzBuzzSpec = fizzSpec.And(buzzSpec); }
public string Transform(int value) { var buzzSpec = new BuzzSpecification(); var fizzSpec = new FizzSpecification(); if (buzzSpec.And(fizzSpec).IsMatch(value)) { return "FizzBuzz"; } if (fizzSpec.IsMatch(value)) { return "Fizz"; } if (buzzSpec.IsMatch(value)) { return "Buzz"; } return value.ToString(); }
public void Initialize() { _buzzSpec = new BuzzSpecification(); }