public async Task GetDTOTest() { //Arrange _repoWrapper.Setup(x => x.EventCategory.GetAllAsync(null, null)) .ReturnsAsync(GetEventCategories()); //Act var eventCategoryManager = new EventCategoryManager(_repoWrapper.Object, _eventTypeManager.Object); var methodResult = await eventCategoryManager.GetDTOAsync(); //Assert Assert.NotNull(methodResult); Assert.IsAssignableFrom<IEnumerable<EventCategoryDTO>>(methodResult); Assert.Equal(GetEventCategories().Count(), methodResult.ToList().Count); }
public async Task GetDTOByEventTypeIdTest() { //Arrange _eventTypeManager.Setup(et => et.GetTypeByIdAsync(It.IsAny<int>())) .ReturnsAsync(GeEventType); var eventTypeId = 1; //Act var eventCategoryManager = new EventCategoryManager(_repoWrapper.Object, _eventTypeManager.Object); var methodResult = await eventCategoryManager.GetDTOByEventTypeIdAsync(eventTypeId); //Assert Assert.NotNull(methodResult); Assert.IsAssignableFrom<IEnumerable<EventCategoryDTO>>(methodResult); Assert.Equal(GeEventType().EventCategories.Count, methodResult.ToList().Count); }