public void GetContactActions_ValidRequest_Succeed() { var mockActions = ActionMockData.GetMockActions(mockRepository, 10).ToList(); mockActionRepository.Setup(cr => cr.FindByContact(It.IsAny <int>())).Returns(mockActions); GetActionListResponse response = actionService.GetContactActions(new GetActionListRequest() { Id = ACTION_ID }); IEnumerable <ActionViewModel> actions = response.ActionListViewModel; mockRepository.VerifyAll(); Assert.AreEqual(mockActions.Count(), actions.Count()); Assert.AreEqual(null, response.Exception); } //Problem with automapper if we use strict mock
public void GetAction_ValidRequest_Succeed() { var mockActions = ActionMockData.GetMockActions(mockRepository, 10).ToList(); mockActionRepository.Setup(cr => cr.FindBy(It.IsAny <int>(), It.IsAny <int>())).Returns(mockActions[0]); GetActionResponse response = actionService.GetAction(new GetActionRequest() { Id = ACTION_ID, ContactId = CONTACT_ID }); ActionViewModel action = response.ActionViewModel; mockRepository.VerifyAll(); Assert.AreEqual(0, action.ActionId); Assert.AreEqual(null, response.Exception); } //Problem with automapper if we use strict mock