Ejemplo n.º 1
0
            public void CallGetPageOnce_WhenCalled()
            {
                // Arrange
                var visitsServiceMock         = new Mock <IVisitsService>();
                var municipalitiesServiceMock = new Mock <IMunicipalitiesService>();
                var usersServiceMock          = new Mock <IUserService>();
                var pageServiceMock           = new Mock <IPageService <Visit> >();

                var controller = new VisitsController(visitsServiceMock.Object, municipalitiesServiceMock.Object, usersServiceMock.Object, pageServiceMock.Object);

                pageServiceMock.Setup(vs => vs.GetPage(It.IsAny <short>(), It.IsAny <short>(), It.IsAny <string>())).Returns(new List <Visit>());
                pageServiceMock.Setup(vs => vs.Count).Returns(5);

                // Act
                controller.List();

                // Assert
                pageServiceMock.Verify(vs => vs.GetPage(It.IsAny <short>(), It.IsAny <short>(), It.IsAny <string>()), Times.Once());
            }