Esempio n. 1
0
        public async Task GetCamps_ReturnOkObjectResult()
        {
            //Arrange
            _mockCalendarService
            .Setup(x => x.GetAllCamps())
            .ReturnsAsync(GetAllEventsTest());

            //Act
            var result = await _eventsCalendarController.GetCamps();

            //Assert
            _mockCalendarService.Verify();
            Assert.IsNotNull(result);
            Assert.IsInstanceOf <OkObjectResult>(result);
        }
        public async Task GetCamps_ReturnOkObjectResult()
        {
            //Arrange
            _mockCalendarService
            .Setup(x => x.GetAllCamps())
            .ReturnsAsync(GetAllEventsTest());

            //Act
            var result = await _eventsCalendarController.GetCamps();

            //Assert
            _mockCalendarService.Verify();
            Assert.AreEqual(((result as ObjectResult).Value as IEnumerable <EventCalendarInfoDTO>).Count(), expectedCount);
            Assert.IsNotNull(result);
            Assert.IsInstanceOf <OkObjectResult>(result);
        }