Beispiel #1
0
        public void NotBeNull()
        {
            // Arrange
            var service = new Mock <ICustomerRestCallService>();
            CustomersController controller = new CustomersController(service.Object);

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

            // Assert
            Assert.IsNotNull(result);
        }
Beispiel #2
0
        public void BeNull()
        {
            // Arrange
            IList <CustomerModel> allCustomers = null;
            var service = new Mock <ICustomerRestCallService>();

            service.Setup(x => x.GetAllCustomers()).Returns(allCustomers);
            CustomersController controller = new CustomersController(service.Object);

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

            // Assert
            Assert.IsNull(result);
        }
Beispiel #3
0
        public void GetAllCustomers_ShouldReturnAllCustomers()
        {
            var result = controller.AllCustomers() as OkNegotiatedContentResult <List <Customer> >;

            Assert.AreEqual(4, result.Content.Count);
        }