public void Get_ShouldNotFindTransaction()
        {
            TransactionRepository repo = new TransactionRepository();
            var transactionController = new TransactionsController(repo);

            var result = transactionController.Get(-1);

            Assert.That(result, Is.TypeOf<NotFoundResult>());
        }
        public void Get_ReturnsListOfTransactions()
        {
            TransactionRepository repo = new TransactionRepository();
            var transactionController = new TransactionsController(repo);

            IHttpActionResult result = transactionController.Get();

            Assert.That(result, Is.TypeOf<OkNegotiatedContentResult<IEnumerable<Transaction>>>());

            var okResult = result as OkNegotiatedContentResult<IEnumerable<Transaction>>;
            Assert.That(repo.Get().Count(), Is.EqualTo(okResult.Content.Count()));
        }
        public void Get_ShouldReturnCorrectTransaction()
        {
            var mockRepository = new Mock<ITransactionRepository>();
            var expected = new Transaction() { TransactionId = 4};
            mockRepository
                .Setup(x => x.Get(It.IsAny<long>()))
                .Returns(expected);

            var transactionController = new TransactionsController(mockRepository.Object);

            IHttpActionResult result = transactionController.Get(4);

            mockRepository.VerifyAll();
            Assert.IsNotNull(result);
            Assert.That(result, Is.TypeOf<OkNegotiatedContentResult<Transaction>>());

            var okResult = result as OkNegotiatedContentResult<Transaction>;
            Assert.AreEqual(expected.TransactionId, okResult.Content.TransactionId);
        }