Exemplo n.º 1
0
        public void CheckGSTAndTotalExcludingGST()
        {
            string content = @"Hi Yvaine,
                                <expense>
                                <total>1024.01</total>
                                </expense>
                                Regards,
                                Ivan";

            IContentExtractor extractor = new ContentExtractor();
            RelevantDataBO    actual;
            var result = extractor.GetRelevantData(content, out actual);

            Assert.True(result);
            Assert.NotNull(actual);

            Assert.NotNull(actual.Expense);


            var expected = new RelevantDataBO()
            {
                Expense = new ExpenseBO()
                {
                    Total             = 1024.01M,
                    TotalExcludingGST = 890.44M,
                    GST = 133.57M
                }
            };

            Assert.Equal(expected.Expense.Total, actual.Expense.Total);
            Assert.Equal(expected.Expense.TotalExcludingGST, actual.Expense.TotalExcludingGST);
            Assert.Equal(expected.Expense.GST, actual.Expense.GST);
        }
Exemplo n.º 2
0
        public void SuccessTest(string content)
        {
            IContentExtractor extractor = new ContentExtractor();
            RelevantDataBO    actual;
            var result = extractor.GetRelevantData(content, out actual);

            Assert.False(result);
        }
Exemplo n.º 3
0
        public void NoCostCentre()
        {
            string content = @"Hi Yvaine,
Please create an expense claim for the below. Relevant details are marked up as
requested...
<expense>
<total>1024.01</total><payment_method>personal card</payment_method>
</expense>
From: Ivan Castle
Sent: Friday, 16 February 2018 10:32 AM
To: Antoine Lloyd 
Subject: test
Hi Antoine,
Please create a reservation at the <vendor>Viaduct Steakhouse</vendor> our
<description>development team’s project end celebration dinner</description> on
<date>Thursday 27 April 2017</date>. We expect to arrive around
7.15pm. Approximately 12 people but I’ll confirm exact numbers closer to the day.
Regards,
Ivan";

            IContentExtractor extractor = new ContentExtractor();
            RelevantDataBO    actual;
            var result = extractor.GetRelevantData(content, out actual);

            Assert.True(result);
            Assert.NotNull(actual);
            Assert.NotNull(actual.Expense);


            var expected = new RelevantDataBO()
            {
                Date        = new System.DateTime(2017, 4, 27),
                Description = "development team’s project end celebration dinner",
                Vendor      = "Viaduct Steakhouse",
                Expense     = new ExpenseBO()
                {
                    CostCentre        = "UNKNOWN",
                    PaymentMethod     = "personal card",
                    Total             = 1024.01M,
                    TotalExcludingGST = 890.44M,
                    GST = 133.57M
                }
            };


            AssertResponse(expected, actual);
        }
Exemplo n.º 4
0
        public void InvalidDate()
        {
            string content = @"abc
<expense>
<total>1024.01</total>
</expense>
adfd
<date>Monday 27 April 2017</date>.
Regards,
Ivan";

            IContentExtractor extractor = new ContentExtractor();
            RelevantDataBO    actual;
            var result = extractor.GetRelevantData(content, out actual);

            Assert.True(result);
            Assert.NotNull(actual);
            Assert.Equal(DateTime.MinValue, actual.Date);
        }