public void CanAddSection()
        {
            Mock<IRepository<Section>> mock_section = new Mock<IRepository<Section>>();
            mock_section.Setup(m => m.Repository).Returns(CreateSectionTab().AsQueryable());

            SectionController controller = new SectionController(mock_section.Object);
            SectionModel section = new SectionModel();

            section.email = "*****@*****.**";
            section.locality = "Gdańsk";
            section.name = "XXX";
            section.phone_number = "552134152";
            section.post = "Gdańsk";
            section.postal_code = "22-242";
            section.short_name = "IMZ8";
            section.street = "Królewska 11";

            var redirectToRouteResult = controller.Add(section) as RedirectToRouteResult;
            mock_section.Verify(m => m.AddObject(It.IsAny<Section>()), Times.Once());

            Assert.IsNotNull(redirectToRouteResult);
            Assert.AreEqual("Index", redirectToRouteResult.RouteValues["Action"]);
        }
        public void CantAddSection()
        {
            Mock<IRepository<Section>> mock_section = new Mock<IRepository<Section>>();
            mock_section.Setup(m => m.Repository).Returns(CreateSectionTab().AsQueryable());

            SectionController controller = new SectionController(mock_section.Object);
            SectionModel section = null;
            var redirectToRouteResult = controller.Add(section) as RedirectToRouteResult;
            mock_section.Verify(m => m.AddObject(It.IsAny<Section>()), Times.Once());

            Assert.IsNotNull(redirectToRouteResult);
            Assert.AreEqual("Index", redirectToRouteResult.RouteValues["Action"]);
        }