public void AddingSingleNumber_ReturnsThatNumber() { var parser = new FakeParser(); var storage = new FakeStorage(); var calculator = new Calculator(parser, storage); var result = calculator.Add("1"); Assert.Equal(1, result); }
public void AddingEmptySet_ReturnsZero() { var parser = new FakeParser(); var storage = new FakeStorage(); var calculator = new Calculator(parser, storage); var result = calculator.Add(""); Assert.Equal(0, result); }
public void UsingTheCalculator_LogsToDatabase() { var parser = new FakeParser(); var storage = Substitute.For <IHistoryStorage>(); var calculator = new Calculator(parser, storage); calculator.Add("1,2,3"); storage.Received().LogUsage("1,2,3", 6); }