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