public void DeletePost_Returns_Journals()
        {
            Mapper.CreateMap <JournalViewModel, Journal>();

            //Arrange
            var membershipRepository = Mock.Create <IStaticMembershipService>();

            var journalRepository = Mock.Create <IJournalRepository>();

            Mock.Arrange(() => journalRepository.DeleteJournal(null)).IgnoreArguments().Returns(
                new OperationStatus()
            {
                Status = true
            }).MustBeCalled();

            //Act
            PublisherController controller   = new PublisherController(journalRepository, membershipRepository);
            ActionResult        actionResult = controller.Delete(new JournalViewModel()
            {
                ContentType = "pdf",
                Content     = new byte[1],
                Description = "abc",
                Id          = 1
            });

            //Assert
            Assert.IsNotNull(actionResult);
        }
        public void Delete_Returns_Journals()
        {
            Mapper.CreateMap <Journal, JournalViewModel>();

            //Arrange
            var membershipRepository = Mock.Create <IStaticMembershipService>();
            var userMock             = Mock.Create <MembershipUser>();

            Mock.Arrange(() => userMock.ProviderUserKey).Returns(1);
            Mock.Arrange(() => membershipRepository.GetUser()).Returns(userMock);

            var journalRepository = Mock.Create <IJournalRepository>();

            Mock.Arrange(() => journalRepository.GetJournalById(1)).Returns(
                new Journal
            {
                Id           = 1,
                Description  = "TestDesc",
                FileName     = "TestFilename.pdf",
                Title        = "Tester",
                UserId       = 1,
                ModifiedDate = DateTime.Now,
                Content      = new byte[] { },
                ContentType  = "pdf"
            }).MustBeCalled();

            //Act
            PublisherController controller   = new PublisherController(journalRepository, membershipRepository);
            ActionResult        actionResult = controller.Delete(1);

            //Assert
            Assert.IsNotNull(actionResult);
        }
Ejemplo n.º 3
0
        public void Delete_ReturnsIActionResultWhenCompanyName()
        {
            // Arrange
            string companyName = "alihandro";

            // Act
            var result = _publisherController.Delete(companyName) as IActionResult;

            // Assert
            Assert.NotNull(result);
        }