Ejemplo n.º 1
0
        public void CanDeliverASingleExpeseRecord(string recordId)
        {
            var subject = new ExpenseRepository();

            subject
            .FindById(Guid.Parse(recordId))
            .Should().NotBeNull();
        }
Ejemplo n.º 2
0
        public void CanDeleteRecord()
        {
            var subject = new ExpenseRepository();
            var id      = Guid.Parse("00000000-0000-0000-0000-000000000005");

            subject
            .Invoking(x => x.Delete(id))
            .ShouldNotThrow();
            subject
            .FindById(id)
            .Should().BeNull();
        }
Ejemplo n.º 3
0
        public void CanAddRecord()
        {
            var subject   = new ExpenseRepository();
            var newRecord = new ExpenseRecord
            {
                Id     = Guid.Parse("00000000-0000-0000-0000-000000000006"),
                Name   = "Anakin Skywalker",
                Reason = ExpenseReason.Hotel,
                Amount = 20m,
                Text   = "Cheap hotel in Mom's guest room.",
                Date   = 6.October(2016)
            };

            subject
            .Invoking(x => x.Create(newRecord))
            .ShouldNotThrow();
            subject
            .FindById(newRecord.Id)
            .ShouldBeEquivalentTo(newRecord);
        }
Ejemplo n.º 4
0
        public void CanUpdateRecord()
        {
            var subject       = new ExpenseRepository();
            var updatedRecord = new ExpenseRecord
            {
                Id     = Guid.Parse("00000000-0000-0000-0000-000000000001"),
                Date   = 12.October(2016),
                Name   = "Anakin Skywalker",
                Reason = ExpenseReason.Taxi,
                Text   = "Taxi to Tatooine, visiting Mom",
                Amount = 12.5m
            };

            subject
            .Invoking(x => x.Update(updatedRecord))
            .ShouldNotThrow();
            subject
            .FindById(updatedRecord.Id)
            .ShouldBeEquivalentTo(updatedRecord);
        }