public async Task ReturnSuccessfulOfmQueryResult_UsingPost()
        {
            await Task.Run(async() =>
            {
                // Arrange
                using (var testAppConfiguration = new AppConfigurationMock(File.ReadAllText(Path.GetDirectoryName(typeof(Startup).GetTypeInfo().Assembly.Location) + "\\appsettings.json")))
                {
                    // ARRANGE
                    var httpContextAccessorMock     = new Mock <IHttpContextAccessor>();
                    var httpRequestExecuter         = new Mock <IHttpRequestExecuter>();
                    var workoutHistoryOfmRepository = new WorkoutHistoryApiModelRepository(
                        testAppConfiguration.Instance, httpContextAccessorMock.Object, httpRequestExecuter.Object);

                    var workoutHistoryOfmForPost = new WorkoutHistoryOfmForPost()
                    {
                        WorkoutId = 4
                    };

                    var returnedWorkoutHistoryOfmForGet = new WorkoutHistoryOfmForGet()
                    {
                        Id      = 1,
                        Workout = new WorkoutHistoryOfmForGet.WorkoutOfm()
                        {
                            Id   = 4,
                            Name = "MockWorkout"
                        }
                    };

                    var uri                 = new Uri(testAppConfiguration.Instance.GetValue <string>("FittifyApiBaseUrl") + "api/workouthistories");
                    var httpResponse        = new HttpResponseMessage();
                    httpResponse.Content    = new StringContent(JsonConvert.SerializeObject(returnedWorkoutHistoryOfmForGet));
                    httpResponse.StatusCode = HttpStatusCode.OK;
                    httpRequestExecuter
                    .Setup(s => s.Post(uri, workoutHistoryOfmForPost, testAppConfiguration.Instance, httpContextAccessorMock.Object))
                    .ReturnsAsync(httpResponse);

                    // ACT
                    var ofmQueryResult = await workoutHistoryOfmRepository.Post(workoutHistoryOfmForPost);

                    // Assert
                    var actualOfmQueryResult = JsonConvert.SerializeObject(ofmQueryResult, new JsonSerializerSettings()
                    {
                        Formatting = Newtonsoft.Json.Formatting.Indented
                    }).MinifyJson().PrettifyJson();
                    var expectedOfmQueryResult =
                        @"
                            {
                              ""OfmForGet"": {
                                ""Id"": 1,
                                ""Workout"": {
                                  ""Id"": 4,
                                  ""Name"": ""MockWorkout""
                                },
                                ""RangeOfExerciseHistoryIds"": null,
                                ""ExerciseHistories"": null,
                                ""DateTimeStart"": null,
                                ""DateTimeEnd"": null
                              },
                              ""HttpStatusCode"": 200,
                              ""HttpResponseHeaders"": [],
                              ""ErrorMessagesPresented"": null
                            }
                        ".MinifyJson().PrettifyJson();

                    Assert.AreEqual(actualOfmQueryResult, expectedOfmQueryResult);
                }
            });
        }
        public async Task ReturnOfmQueryResultWithErrorMessages_UsingPostWithIncludeExerciseHistoresOverload()
        {
            await Task.Run(async() =>
            {
                // Arrange
                using (var testAppConfiguration = new AppConfigurationMock(File.ReadAllText(Path.GetDirectoryName(typeof(Startup).GetTypeInfo().Assembly.Location) + "\\appsettings.json")))
                {
                    // ARRANGE
                    var httpContextAccessorMock     = new Mock <IHttpContextAccessor>();
                    var httpRequestExecuter         = new Mock <IHttpRequestExecuter>();
                    var workoutHistoryOfmRepository = new WorkoutHistoryApiModelRepository(
                        testAppConfiguration.Instance, httpContextAccessorMock.Object, httpRequestExecuter.Object);

                    var workoutHistoryOfmForPost = new WorkoutHistoryOfmForPost()
                    {
                        WorkoutId = 4
                    };

                    var queryResult = new Dictionary <string, object>()
                    {
                        {
                            "workouthistory",
                            new List <string>()
                            {
                                "Some error message",
                                "Some other error message"
                            }
                        }
                    };

                    var uri                 = new Uri(testAppConfiguration.Instance.GetValue <string>("FittifyApiBaseUrl") + "api/workouthistories?includeExerciseHistories=1");
                    var httpResponse        = new HttpResponseMessage();
                    httpResponse.Content    = new StringContent(JsonConvert.SerializeObject(queryResult));
                    httpResponse.StatusCode = HttpStatusCode.BadRequest;
                    httpRequestExecuter.Setup(s => s.Post(uri, workoutHistoryOfmForPost, testAppConfiguration.Instance, httpContextAccessorMock.Object)).ReturnsAsync(httpResponse);

                    // ACT
                    var ofmQueryResult = await workoutHistoryOfmRepository.Post(workoutHistoryOfmForPost, includeExerciseHistories: true);

                    // Assert
                    var actualOfmQueryResult = JsonConvert.SerializeObject(ofmQueryResult, new JsonSerializerSettings()
                    {
                        Formatting = Newtonsoft.Json.Formatting.Indented
                    }).MinifyJson().PrettifyJson();
                    var expectedOfmQueryResult =
                        @"
                            {
                              ""OfmForGet"": null,
                              ""HttpStatusCode"": 400,
                              ""HttpResponseHeaders"": [],
                              ""ErrorMessagesPresented"": {
                                ""workouthistory"": [
                                  ""Some error message"",
                                  ""Some other error message""
                                ]
                              }
                            }
                        ".MinifyJson().PrettifyJson();

                    Assert.AreEqual(actualOfmQueryResult, expectedOfmQueryResult);
                }
            });
        }