public void Save_ShouldPassValidation()
 {
     //db context, inject into controller
     var context = new ReceiptContextTest();
     var receipttoValidate = context.GetSingleReceipt();
     var result = Validator.TryValidateObject(receipttoValidate, new ValidationContext(receipttoValidate), null, true);
     Assert.IsTrue(result);
 }
        public void GetProduct_ShouldReturnReceiptWithSameID()
        {
            //db context, inject into controller
            var context = new ReceiptContextTest();
            context.Receipts.Add(context.GetSingleReceipt());

            var controller = new apiReceiptsController(context);
            var result = controller.GetReceipt(3) as OkNegotiatedContentResult<Receipt>;

            Assert.IsNotNull(result);
            Assert.AreEqual(3, result.Content.ID);
        }
        public void Index()
        {
            var context = new ReceiptContextTest();
            // Arrange
            ReceiptsController controller = new ReceiptsController(context);

            // Act
            ViewResult result = controller.Index() as ViewResult;

            // Assert
            Assert.IsNotNull(result);
        }
        public void Details_ShouldReturnReceiptWithSameID()
        {
            //db context, inject into controller
            var context = new ReceiptContextTest();
            context.Receipts.Add(context.GetSingleReceipt());

            var controller = new ReceiptsController(context);
            var result = controller.Details(3) as ViewResult;

            Assert.IsNotNull(result);
            Assert.AreEqual(3, ((Receipt)result.Model).ID);
        }