Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }