public void TestInitialize() { UserId = -1; locationListModel = new List <LocationListModel>(); _getLocationListBasedOnUserIdQuery = new Mock <IGetLocationListBasedOnUserIdQuery>(); _getLocationListBasedOnUserId = new GetLocationListBasedOnUserId(_getLocationListBasedOnUserIdQuery.Object); }
//To have a clean code in controller, all the dependencies have been moved to base location controller //TODO: This can be still refactored using MediatR public LocationsController(ICreateLocation createLocation, IGetLocationDetail getLocationDetail, IGetLocationListBasedOnUserId getLocationListBasedOnUserId, IGetLocationListBasedOnSearchText getLocationListBasedOnSearchText, IGetUserLocationList getUserLocationList) : base(createLocation, getLocationDetail, getLocationListBasedOnUserId, getLocationListBasedOnSearchText, getUserLocationList) { }
/// <summary> /// Contructor injection for all the micro services /// </summary> /// <param name="createLocation">Creates a new location for the logged-in user (Input: User Id, Location object)</param> /// <param name="getLocationDetail">Retrieves a location details (Input: Location ID)</param> /// <param name="getLocationListBasedOnUserId">Retrieves list of locations for logged-in user(Input: User ID)</param> /// <param name="getLocationListBasedOnSearchText">Retrieves list of locations based on remarks(Input: any text)</param> /// <param name="getUserLocationList">Retrieves list of locations based on username(Input: User name)</param> public BaseLocationController(ICreateLocation createLocation, IGetLocationDetail getLocationDetail, IGetLocationListBasedOnUserId getLocationListBasedOnUserId, IGetLocationListBasedOnSearchText getLocationListBasedOnSearchText, IGetUserLocationList getUserLocationList) { _createLocation = createLocation; _getLocationDetail = getLocationDetail; _getLocationListBasedOnUserId = getLocationListBasedOnUserId; _getLocationListBasedOnSearchText = getLocationListBasedOnSearchText; _getUserLocationList = getUserLocationList; }