public MockedWorkoutController() { if (_authenticatedInstance == null) { lock (_padlock) { if (_authenticatedInstance == null) { ApiTestServerWithTestInMemoryDb = TestServers.GetApiTestServerInstanceWithTestInMemoryDb(); ClientTestServer = TestServers.GetApiAuthenticatedClientTestServerInstance(ApiTestServerWithTestInMemoryDb); // Arrange var workoutViewModelRepository = ClientTestServer.Host.Services.GetService(typeof(IViewModelRepository <int, WorkoutViewModel, WorkoutOfmForPost, WorkoutOfmResourceParameters, WorkoutOfmCollectionResourceParameters>)) as IViewModelRepository <int, WorkoutViewModel, WorkoutOfmForPost, WorkoutOfmResourceParameters, WorkoutOfmCollectionResourceParameters>; var mapExerciseWorkoutViewModelRepository = ClientTestServer.Host.Services.GetService(typeof(IViewModelRepository <int, MapExerciseWorkoutViewModel, MapExerciseWorkoutOfmForPost, MapExerciseWorkoutOfmResourceParameters, MapExerciseWorkoutOfmCollectionResourceParameters>)) as IViewModelRepository <int, MapExerciseWorkoutViewModel, MapExerciseWorkoutOfmForPost, MapExerciseWorkoutOfmResourceParameters, MapExerciseWorkoutOfmCollectionResourceParameters>; var workoutHistoryViewModelRepository = ClientTestServer.Host.Services.GetService(typeof(IViewModelRepository <int, WorkoutHistoryViewModel, WorkoutHistoryOfmForPost, WorkoutHistoryOfmResourceParameters, WorkoutHistoryOfmCollectionResourceParameters>)) as IViewModelRepository <int, WorkoutHistoryViewModel, WorkoutHistoryOfmForPost, WorkoutHistoryOfmResourceParameters, WorkoutHistoryOfmCollectionResourceParameters>; var weightLiftingSetViewModelRepository = ClientTestServer.Host.Services.GetService(typeof(IViewModelRepository <int, WeightLiftingSetViewModel, WeightLiftingSetOfmForPost, WeightLiftingSetOfmResourceParameters, WeightLiftingSetOfmCollectionResourceParameters>)) as IViewModelRepository <int, WeightLiftingSetViewModel, WeightLiftingSetOfmForPost, WeightLiftingSetOfmResourceParameters, WeightLiftingSetOfmCollectionResourceParameters>; _authenticatedInstance = new View.Controllers.WorkoutController(workoutViewModelRepository, mapExerciseWorkoutViewModelRepository, workoutHistoryViewModelRepository, weightLiftingSetViewModelRepository); } } } if (_unAuthenticatedInstance == null) { lock (_padlock) { if (_unAuthenticatedInstance == null) { ApiTestServerWithNoDatabase = TestServers.GetApiTestServerInstanceWithNoDatabase(); ClientTestServer = TestServers.GetApiUnAuthenticatedClientTestServerInstance(ApiTestServerWithTestInMemoryDb); // Arrange var workoutViewModelRepository = ClientTestServer.Host.Services.GetService(typeof(IViewModelRepository <int, WorkoutViewModel, WorkoutOfmForPost, WorkoutOfmResourceParameters, WorkoutOfmCollectionResourceParameters>)) as IViewModelRepository <int, WorkoutViewModel, WorkoutOfmForPost, WorkoutOfmResourceParameters, WorkoutOfmCollectionResourceParameters>; var mapExerciseWorkoutViewModelRepository = ClientTestServer.Host.Services.GetService(typeof(IViewModelRepository <int, MapExerciseWorkoutViewModel, MapExerciseWorkoutOfmForPost, MapExerciseWorkoutOfmResourceParameters, MapExerciseWorkoutOfmCollectionResourceParameters>)) as IViewModelRepository <int, MapExerciseWorkoutViewModel, MapExerciseWorkoutOfmForPost, MapExerciseWorkoutOfmResourceParameters, MapExerciseWorkoutOfmCollectionResourceParameters>; var workoutHistoryViewModelRepository = ClientTestServer.Host.Services.GetService(typeof(IViewModelRepository <int, WorkoutHistoryViewModel, WorkoutHistoryOfmForPost, WorkoutHistoryOfmResourceParameters, WorkoutHistoryOfmCollectionResourceParameters>)) as IViewModelRepository <int, WorkoutHistoryViewModel, WorkoutHistoryOfmForPost, WorkoutHistoryOfmResourceParameters, WorkoutHistoryOfmCollectionResourceParameters>; var weightLiftingSetViewModelRepository = ClientTestServer.Host.Services.GetService(typeof(IViewModelRepository <int, WeightLiftingSetViewModel, WeightLiftingSetOfmForPost, WeightLiftingSetOfmResourceParameters, WeightLiftingSetOfmCollectionResourceParameters>)) as IViewModelRepository <int, WeightLiftingSetViewModel, WeightLiftingSetOfmForPost, WeightLiftingSetOfmResourceParameters, WeightLiftingSetOfmCollectionResourceParameters>; _unAuthenticatedInstance = new View.Controllers.WorkoutController(workoutViewModelRepository, mapExerciseWorkoutViewModelRepository, workoutHistoryViewModelRepository, weightLiftingSetViewModelRepository); } } } }
public MockedWorkoutHistoryController() { if (_authenticatedInstance == null) { lock (_padlock) { if (_authenticatedInstance == null) { ApiTestServerWithTestInMemoryDb = TestServers.GetApiTestServerInstanceWithTestInMemoryDb(); ClientTestServer = TestServers.GetApiAuthenticatedClientTestServerInstance(ApiTestServerWithTestInMemoryDb); // Arrange var workoutHistoryViewModelRepository = ClientTestServer.Host.Services.GetService(typeof(IWorkoutHistoryViewModelRepository)) as IWorkoutHistoryViewModelRepository; var exerciseHistoryApiModelRepository = ClientTestServer.Host.Services.GetService(typeof(IApiModelRepository <int, ExerciseHistoryOfmForGet, ExerciseHistoryOfmForPost, ExerciseHistoryOfmCollectionResourceParameters>)) as IApiModelRepository <int, ExerciseHistoryOfmForGet, ExerciseHistoryOfmForPost, ExerciseHistoryOfmCollectionResourceParameters>; _authenticatedInstance = new View.Controllers.WorkoutHistoryController(workoutHistoryViewModelRepository, exerciseHistoryApiModelRepository); } } } if (_unAuthenticatedInstance == null) { lock (_padlock) { if (_unAuthenticatedInstance == null) { ApiTestServerWithNoDatabase = TestServers.GetApiTestServerInstanceWithNoDatabase(); ClientTestServer = TestServers.GetApiUnAuthenticatedClientTestServerInstance(ApiTestServerWithTestInMemoryDb); // Arrange var workoutHistoryViewModelRepository = ClientTestServer.Host.Services.GetService(typeof(IWorkoutHistoryViewModelRepository)) as IWorkoutHistoryViewModelRepository; var exerciseHistoryApiModelRepository = ClientTestServer.Host.Services.GetService(typeof(IApiModelRepository <int, ExerciseHistoryOfmForGet, ExerciseHistoryOfmForPost, ExerciseHistoryOfmCollectionResourceParameters>)) as IApiModelRepository <int, ExerciseHistoryOfmForGet, ExerciseHistoryOfmForPost, ExerciseHistoryOfmCollectionResourceParameters>; _unAuthenticatedInstance = new View.Controllers.WorkoutHistoryController(workoutHistoryViewModelRepository, exerciseHistoryApiModelRepository); } } } }
public MockedCategoryController() { if (_authenticatedInstance == null) { lock (_padlock) { if (_authenticatedInstance == null) { ApiTestServerWithTestInMemoryDb = TestServers.GetApiTestServerInstanceWithTestInMemoryDb(); ClientTestServer = TestServers.GetApiAuthenticatedClientTestServerInstance(ApiTestServerWithTestInMemoryDb); // Arrange var categoryViewModelRepository = ClientTestServer.Host.Services.GetService(typeof(IViewModelRepository <int, CategoryViewModel, CategoryOfmForPost, CategoryOfmResourceParameters, CategoryOfmCollectionResourceParameters>)) as IViewModelRepository <int, CategoryViewModel, CategoryOfmForPost, CategoryOfmResourceParameters, CategoryOfmCollectionResourceParameters>; _authenticatedInstance = new View.Controllers.CategoryController(categoryViewModelRepository); } } } if (_unAuthenticatedInstance == null) { lock (_padlock) { if (_unAuthenticatedInstance == null) { ApiTestServerWithNoDatabase = TestServers.GetApiTestServerInstanceWithNoDatabase(); ClientTestServer = TestServers.GetApiUnAuthenticatedClientTestServerInstance(ApiTestServerWithTestInMemoryDb); // Arrange var categoryViewModelRepository = ClientTestServer.Host.Services.GetService(typeof(IViewModelRepository <int, CategoryViewModel, CategoryOfmForPost, CategoryOfmResourceParameters, CategoryOfmCollectionResourceParameters>)) as IViewModelRepository <int, CategoryViewModel, CategoryOfmForPost, CategoryOfmResourceParameters, CategoryOfmCollectionResourceParameters>; _unAuthenticatedInstance = new View.Controllers.CategoryController(categoryViewModelRepository); } } } }