public void Post_MismatchingId_ThrowsException()
        {
            // arrange
            var existingTransaction = new Transaction
            {
                TransactionId     = 2,
                CurrencyCode      = "GBP",
                TransactionAmount = 54.99M,
                CreatedDate       = DateTime.UtcNow
            };

            var subject = new Api.Controllers.TransactionsController(_transactionService);

            // act
            subject.Put(99, existingTransaction);

            // assert
            Assert.IsTrue(false, "exception should be thrown");
        }
        public void Post_ExistingTansaction_UpdatesTransaction()
        {
            // arrange
            var existingTransaction = new Transaction
            {
                TransactionId     = 2,
                CurrencyCode      = "GBP",
                TransactionAmount = 54.99M,
                CreatedDate       = DateTime.UtcNow
            };

            var subject = new Api.Controllers.TransactionsController(_transactionService);

            // act
            subject.Put(existingTransaction.TransactionId, existingTransaction);

            // assert
            _transactionRepositoryMock.Verify(x => x.Update(existingTransaction), Times.Once);
        }
        public void Post_MismatchingId_ThrowsException()
        {
            // arrange
            var existingTransaction = new Transaction
            {
                TransactionId = 2,
                CurrencyCode = "GBP",
                TransactionAmount = 54.99M,
                CreatedDate = DateTime.UtcNow
            };

            var subject = new Api.Controllers.TransactionsController(_transactionService);

            // act
            subject.Put(99, existingTransaction);

            // assert
            Assert.IsTrue(false, "exception should be thrown");
        }
        public void Post_ExistingTansaction_UpdatesTransaction()
        {
            // arrange
            var existingTransaction = new Transaction
            {
                TransactionId = 2,
                CurrencyCode = "GBP",
                TransactionAmount = 54.99M,
                CreatedDate = DateTime.UtcNow
            };

            var subject = new Api.Controllers.TransactionsController(_transactionService);

            // act
            subject.Put(existingTransaction.TransactionId, existingTransaction);

            // assert
            _transactionRepositoryMock.Verify(x => x.Update(existingTransaction), Times.Once);
        }