예제 #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);
        }
예제 #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);
        }
예제 #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();
        }