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 GetCustomerId() { _db = new MockDbBuilder() .WithCustomer(CUSTOMER) .Build(); _service = new CustomerTransactionLogService(_db.Object, _mapper); _service.GetCustomerId(IDENT_USER_ID).Should().Be(CUSTOMER_ID); }
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(); }
public void WasResponseSuccessful() { _service = new CustomerTransactionLogService(_db.Object, _mapper); _service.WasResponseSuccessful(@"{ ""errors"": [ { ""data"": null, ""code"": 0, ""display"": false, ""message"": ""Load not found"", ""stackTrace"": null } ], ""data"": null, ""Success"":TRUE }").Should().BeTrue(); }
public void WasResponseSuccessful_Null(string response) { _service = new CustomerTransactionLogService(_db.Object, _mapper); _service.WasResponseSuccessful(response).Should().BeFalse(); }
public void GetCustomerId_NotFound() { _service = new CustomerTransactionLogService(_db.Object, _mapper); _service.GetCustomerId(Guid.Empty).Should().NotHaveValue(); _service.GetCustomerId(Guid.NewGuid()).Should().NotHaveValue(); }