示例#1
0
        public void TestSupllierIndex()
        {
            var obj = new SuppliersController();

            var actResult = obj.Index() as ViewResult;

            Assert.That(actResult.ViewName, Is.EqualTo("Index"));
        }
示例#2
0
        public void Index()
        {
            ApplicationDbContext context    = new ApplicationDbContext();
            IUnitOfWork          unitOfWork = new UnitOfWork(context);
            var controller = new SuppliersController(unitOfWork);
            var result     = controller.Index() as ViewResult;

            Assert.AreEqual(expected: "Index", actual: result.ViewName);
        }
示例#3
0
        public void Suppliers_Index()
        {
            // Arrange
            db = new AlexaDbContextTest();
            supplierService = new SupplierService(new SupplierRepositoryTest(db), new GroupRepositoryTest(db));
            groupService    = new GroupService(new SupplierRepositoryTest(db), new GroupRepositoryTest(db));
            controller      = new SuppliersController(supplierService, groupService);

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

            // Assert
            Assert.IsNotNull(result);
        }
示例#4
0
        public async Task Index_ReturnsViewResultWithListOfSupplier()
        {
            // Arrange
            var supplier = new List <Supplier> {
                new Supplier()
                {
                    Id = 1
                }
            };
            var mockRepo = new Mock <IInvoicesRepository>();

            mockRepo.Setup(repo => repo.ListSuppliersAsync()).ReturnsAsync(supplier);
            var controller = new SuppliersController(mockRepo.Object);

            // Act
            var result = await controller.Index();

            // Assert
            var viewResult = Assert.IsType <ViewResult>(result);
            var model      = Assert.IsAssignableFrom <IEnumerable <Supplier> >(viewResult.ViewData.Model);

            Assert.Single(model);
        }
        public void Supplier_LoadSupplierIndex_ReturnsSupplierIndexView()
        {
            var result = _suppliersController.Index() as ViewResult;

            Assert.AreEqual("Index", result.ViewName);
        }