Exemplo n.º 1
0
        public void WhenExpenseIsNotFound_ShouldReturnNull(string data)
        {
            // ARRANGE
            var parser = new XmlExpenseParser();

            // ACT
            var expense = parser.Parse(data);

            // ASSERT
            Assert.IsNull(expense, "Expense object should be null");
        }
Exemplo n.º 2
0
        public void WhenTotalIsNotAvailable_ShouldNotParseExpenseObject(string data)
        {
            // ARRANGE
            var parser = new XmlExpenseParser();

            // ACT
            var expense = parser.Parse(data);

            // ASSERT
            Assert.IsNull(expense, "No expense object should be returned");
        }
Exemplo n.º 3
0
        public void WhenCostCentreIsNotFound_ShouldDefaultToUnknown(string data)
        {
            // ARRANGE
            var parser = new XmlExpenseParser();

            // ACT
            var expense = parser.Parse(data);

            // ASSERT
            Assert.AreEqual(expense?.CostCentre, "UNKNOWN", "Cost Centre should be unknown");
        }
Exemplo n.º 4
0
        public void WhenExpenseObjectExistsInText_ShouldParseSuccessfully(string data)
        {
            // ARRANGE
            var parser = new XmlExpenseParser();

            // ACT
            var expense = parser.Parse(data);

            // ASSERT
            Assert.IsNotNull(expense, "Expense object was not found");
            Assert.AreEqual(expense.Total, (decimal)890.55, "Total was not parsed correctly");
            Assert.AreEqual(expense.CostCentre, "DEV002", "Cost Centre was not parsed correctly");
            Assert.AreEqual(expense.PaymentMethod, "personal card", "Payment method was not parsed correctly");
        }