コード例 #1
0
        public void GetPublishers_BLLReturnsSomeData()
        {
            // Arrange
            _mockPublisher.Setup(a => a.GetAll(false)).Returns(new List <PublisherDTO>());

            // Act
            var res = _controller.Index();

            // Assert
            Assert.AreEqual(res.GetType(), typeof(ViewResult));
        }
コード例 #2
0
        public void IndexTest()
        {
            // Arrange
            PublishersController controller = new PublishersController();

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

            // Assert
            Assert.IsNotNull(result);
        }
コード例 #3
0
        public void Controller_Without_IndexFilter_Will_Use_Default_Func()
        {
            var simpleController = new PublishersController(
                new RepositoryMock <Publisher>(new[] { new Publisher() }),
                new Mock <IViewEntityModelMapper <Publisher, ViewPublisherModel> >().Object,
                new Mock <EditPublisherModelMapper>().Object);

            var result = (ViewResult)simpleController.Index();

            Assert.That(result.Model, Is.InstanceOf <IEnumerable <ViewPublisherModel> >());
            Assert.That(((IEnumerable <ViewPublisherModel>)result.Model).Count(), Is.EqualTo(1));
        }
コード例 #4
0
        public void IndexActionReturnsListofPublishers()
        {
            var repository = new FakeRepository <Publisher>();



            var controller = new PublishersController(repository);

            var controller1 = new PublishersController(new ApplicationDbContext());

            var result = controller.Index() as ViewResult;

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result.Model, typeof(List <Publisher>));
        }