コード例 #1
0
        public void not_write_in_file_when_exception()
        {
            var numbers = "-1";

            Action operation = () => SaveAction.Run(_save, numbers);

            File.Exists(_path).Should().Be(false);
            operation.Should().Throw <Exception>().WithMessage("Can not get result due to an exception: negatives not allowed: " + numbers);
        }
コード例 #2
0
        public void write_in_file_StringCalculatorAdd_result()
        {
            var numbers = "1,2\n4";

            SaveAction.Run(_save, numbers);
            _sr = new StreamReader(_path);
            var writeLine = _sr.ReadToEnd();

            _sr.Close();

            writeLine.Should().Contain(numbers.Replace("\n", "[\\n]") + " = " + StringCalculator.Add(numbers));
        }