Example #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);
        }
Example #2
0
        public void GetCustomerId()
        {
            _db = new MockDbBuilder()
                  .WithCustomer(CUSTOMER)
                  .Build();
            _service = new CustomerTransactionLogService(_db.Object, _mapper);

            _service.GetCustomerId(IDENT_USER_ID).Should().Be(CUSTOMER_ID);
        }
Example #3
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);
        }
Example #4
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();
        }
Example #5
0
 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();
 }
Example #6
0
 public void WasResponseSuccessful_Null(string response)
 {
     _service = new CustomerTransactionLogService(_db.Object, _mapper);
     _service.WasResponseSuccessful(response).Should().BeFalse();
 }
Example #7
0
 public void GetCustomerId_NotFound()
 {
     _service = new CustomerTransactionLogService(_db.Object, _mapper);
     _service.GetCustomerId(Guid.Empty).Should().NotHaveValue();
     _service.GetCustomerId(Guid.NewGuid()).Should().NotHaveValue();
 }