Ejemplo n.º 1
0
        public void LogTransaction_CustomerNotFound()
        {
            _service = new CustomerTransactionLogService(_db.Object, _mapper);

            _service.LogTransaction(Guid.NewGuid(), "url", "request", "response").Should().BeFalse();
            _db.Verify(x => x.SaveChanges(_username), Times.Never);
        }
Ejemplo n.º 2
0
        public void LogTransaction()
        {
            _db = new MockDbBuilder()
                  .WithCustomer(CUSTOMER)
                  .Build();
            _service = new CustomerTransactionLogService(_db.Object, _mapper);

            _service.LogTransaction(IDENT_USER_ID, "url", "request", "response").Should().BeTrue();
            _db.Verify(x => x.SaveChanges(_username), Times.Once);
        }
Ejemplo n.º 3
0
        public void LogTransaction_ExceptionIsntThrown()
        {
            _db = new MockDbBuilder()
                  .WithCustomer(CUSTOMER)
                  .Build();
            _db.Setup(x => x.CustomerTransactionLogs).Throws(new Exception("unit test exception"));

            _service = new CustomerTransactionLogService(_db.Object, _mapper);

            _service.LogTransaction(IDENT_USER_ID, "url", "request", "response").Should().BeFalse();
        }