Exemplo n.º 1
0
        public void ShouldProcessOfficialAbnAmroBankExportFile()
        {
            var inputFileData        = File.ReadAllText(Path.Combine(LocationOfTestFiles, "THREE_MONTH_ABN_AMRO_EXPORT_FILE.TAB"));
            var inputCategoryMapJson = File.ReadAllText(Path.Combine(LocationOfTestFiles, "TestCategories.json"));

            var parser    = new TransactionParser(inputFileData);
            var processor = new TransactionProcessor(parser, inputCategoryMapJson);
            var cr        = new CategoryReporter(processor);

            var report = cr.CreateReport();

            StringAssert.Contains("unknown: 2453.43 EUR", report);
        }
        public void ReportAmountPerCategory()
        {
            var categoryMapJsonString =
                "{" +
                "\"Categories\": " +
                "[ " +
                "{" +
                "\"Keyword\": \"wallgreens\"," +
                "\"CategoryName\": \"groceries\" " +
                "}," +
                "{" +
                "\"Keyword\": \"wallmart\"," +
                "\"CategoryName\": \"groceries\" " +
                "}," +
                "{" +
                "\"Keyword\": \"visa\"," +
                "\"CategoryName\": \"finances\" " +
                "}," +
                "{" +
                "\"Keyword\": \"mortgage\"," +
                "\"CategoryName\": \"finances\" " +
                "}" +
                "]" +
                "}";

            var transactionParserMock = new Mock <ITransactionParser>();

            transactionParserMock.Setup(x => x.Parse()).Returns(new List <Transaction>
            {
                new Transaction(-10.00M, "xyz", new DateTime(2020, 1, 1)),
                new Transaction(-10.00M, "mortgage inc.", new DateTime(2020, 1, 1)),
                new Transaction(-30.00M, "VISA", new DateTime(2020, 1, 1)),
            });

            var processor = new TransactionProcessor(transactionParserMock.Object, categoryMapJsonString);
            var cr        = new CategoryReporter(processor);

            var report = cr.CreateReport();

            StringAssert.Contains("finances: -40.00 EUR", report);
        }