コード例 #1
0
        public void Post_NewTransaction_InsertsTransaction()
        {
            // arrange
            var newTransaction = new Transaction
            {
                CurrencyCode = "GBP",
                TransactionAmount = 54.99M,
                CreatedDate = DateTime.UtcNow
            };

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

            // act
            subject.Post(newTransaction);

            // assert
            _transactionRepositoryMock.Verify(x => x.Insert(newTransaction), Times.Once);
        }
コード例 #2
0
        public void Post_ExistingTransaction_ThrowsException()
        {
            // arrange
            var existingTransaction = new Transaction
            {
                TransactionId = 1
            };

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

            // act
            subject.Post(existingTransaction);

            // assert
            Assert.IsTrue(false, "exception should be thrown");
        }