protected async Task<Action> CreateTestAction(string verb = "Created for test goal and activity")
        {
            var session = await Login();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id.ToString());
                var action = new Action
                {
                    Verb = verb,
                    Goal =
                        new Goal
                        {
                            Concern = new ConcernMatrix { Coordinates = new Matrix { X = 1, Y = 1 }, Category = 0 },
                            RewardResource =
                                new RewardResourceMatrix { Coordinates = new Matrix { X = 2, Y = 2 }, Category = 0 },
                            Feedback = new GoalFeedback { Threshold = 0, Target = 0, Direction = 0 },
                            Description = "Created for test cases"
                        },
                    Activity = new Activity { Name = "Testing" }
                };
                var actionResponse = await client.PostAsJsonAsync("/api/actions", action);
                Assert.Equal(HttpStatusCode.Created, actionResponse.StatusCode);

                var created = await actionResponse.Content.ReadAsJsonAsync<Action>();

                return created;
            }
        }
        public async Task AddActivityGoal()
        {
            var session = await Login();
            var currentSeed = Guid.NewGuid();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id);

                var form = new Activity { Name = $"Name.{currentSeed}", Description = $"Description.{currentSeed}" };

                // Add Activity with valid data
                var activityResponse = await client.PostAsJsonAsync($"/api/activities", form);
                Assert.Equal(HttpStatusCode.Created, activityResponse.StatusCode);

                var activity = await activityResponse.Content.ReadAsJsonAsync<Activity>();
                Assert.Equal($"Name.{currentSeed}", activity.Name);

                var goalForm = new ActivityGoalForm { Description = $"Description.{currentSeed}" };
                activityResponse = await client.PutAsJsonAsync($"/api/activities/{activity.Id}/goal", goalForm);
                Assert.Equal(HttpStatusCode.OK, activityResponse.StatusCode);

                activity = await activityResponse.Content.ReadAsJsonAsync<Activity>();
                Assert.Equal(1, activity.Goals.Count);
            }
        }
        public async Task WhoAmIWithValidSession()
        {
            var session = await Login();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id);

                var playerResponse = await client.GetAsync("/api/players");
                Assert.Equal(HttpStatusCode.OK, playerResponse.StatusCode);

                var player = await playerResponse.Content.ReadAsJsonAsync<Player>();
                Assert.Equal(session.Player.Id, player.Id);
            }
        }
        public async Task GetMyGroups_WithValidSession()
        {
            var session = await Login();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id);

                // Get My Groups with valid session header
                var groupResponse = await client.GetAsync("/api/groups");
                Assert.Equal(HttpStatusCode.OK, groupResponse.StatusCode);

                var groups = await groupResponse.Content.ReadAsJsonAsync<IList<Group>>();
                Assert.IsType(typeof(List<Group>), groups);
            }
        }
        public async Task GetPlayerWithInvalidSession()
        {
            var sessionId = "unknown";

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(sessionId);

                // Get Player with invalid session header
                var playerResponse = await client.GetAsync("/api/players");
                Assert.Equal(HttpStatusCode.Unauthorized, playerResponse.StatusCode);

                var fetched = await playerResponse.Content.ReadAsJsonAsync<ApiError>();
                Assert.Equal($"Invalid {SessionAuthorizeFilter.SessionHeaderName} Header.", fetched.Error);
            }
        }
        public async Task GetPlayerWithNonExistingSession()
        {
            var sessionId = Guid.NewGuid();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(sessionId);

                // Get Player with non-existing session header
                var playerResponse = await client.GetAsync("/api/players");
                Assert.Equal(HttpStatusCode.NotFound, playerResponse.StatusCode);

                var fetched = await playerResponse.Content.ReadAsJsonAsync<ApiError>();
                Assert.Equal($"Session {sessionId} is Invalid.", fetched.Error);
            }
        }
        public async Task GetActorGroups_WithInvalidActor()
        {
            var session = await Login();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id);

                // Get Actor's Groups with invalid Actor
                var invalidId = Guid.NewGuid();
                var groupResponse = await client.GetAsync($"/api/groups/actor/{invalidId}");
                Assert.Equal(HttpStatusCode.NotFound, groupResponse.StatusCode);

                var fetched = await groupResponse.Content.ReadAsJsonAsync<ApiError>();
                Assert.Equal($"No such Player found.", fetched.Error);
            }
        }
Пример #8
0
        protected async Task<Session> Login(string username = "******", string password = "******")
        {
            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson();

                // login 
                var loginForm = new UserForm { Username = username, Password = password };

                var loginResponse = await client.PostAsJsonAsync("/api/sessions", loginForm);
                Assert.True(loginResponse.IsSuccessStatusCode);

                var created = await loginResponse.Content.ReadAsJsonAsync<Session>();

                return created;
            }
        }
        public async Task GetInvalidAction()
        {
            var session = await Login();
            var invalidId = Guid.NewGuid();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id.ToString());

                // Get action with Invalid Id
                var actionResponse = await client.GetAsync($"/api/actions/{invalidId}");
                Assert.Equal(HttpStatusCode.NotFound, actionResponse.StatusCode);

                var content = await actionResponse.Content.ReadAsJsonAsync<ApiError>();
                Assert.Equal($"No Action found.", content.Error);
            }
        }
        public async Task AddActivityGoal_InvalidId()
        {
            var session = await Login();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id);

                var form = new UserForm();

                // Add Activity Goal with invalid Id
                var invalidId = Guid.NewGuid();
                var activityResponse = await client.PutAsJsonAsync($"/api/activities/{invalidId}/goal", form);
                Assert.Equal(HttpStatusCode.NotFound, activityResponse.StatusCode);

                var content = await activityResponse.Content.ReadAsJsonAsync<ApiError>();
                Assert.Equal("No such Activity found.", content.Error);
            }
        }
        protected async Task<Goal> CreateTestGoal()
        {
            var session = await Login();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id.ToString());
                var goal = new Goal
                {
                    Concern = new ConcernMatrix { Coordinates = new Matrix { X = 1, Y = 1 }, Category = 0 },
                    RewardResource =
                        new RewardResourceMatrix { Coordinates = new Matrix { X = 2, Y = 2 }, Category = 0 },
                    Feedback = new GoalFeedback { Threshold = 0, Target = 0, Direction = 0 },
                    Description = "Created for test cases"
                };
                var goalResponse = await client.PostAsJsonAsync("/api/goals", goal);
                Assert.Equal(HttpStatusCode.Created, goalResponse.StatusCode);

                var created = await goalResponse.Content.ReadAsJsonAsync<Goal>();

                return created;
            }
        }
        public async Task CreateValidActionRelation()
        {
            var session = await Login();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id.ToString());

                var newAction = await CreateTestAction();

                var newAR = new ActionRelation
                {
                    ActionId = newAction.Id,
                    Relationship = 0,
                    ConcernChange = new Matrix { X = 0, Y = 0 },
                    RewardResourceChange = new Matrix { X = 0, Y = 0 }
                };
                var arResponse = await client.PostAsJsonAsync("/api/actions/relations", newAR);
                Assert.Equal(HttpStatusCode.Created, arResponse.StatusCode);

                var action = await arResponse.Content.ReadAsJsonAsync<ActionRelation>();
                Assert.IsType(typeof(ActionRelation), action);
            }
        }
        public async Task UpdateRewardByInvalidAction()
        {
            var session = await Login();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id.ToString());

                var actionForm = new Action { Verb = "invalidVerb" };

                var actionResponse = await client.PostAsJsonAsync("/api/actions/send", actionForm);
                Assert.Equal(HttpStatusCode.NotFound, actionResponse.StatusCode);

                var content = await actionResponse.Content.ReadAsJsonAsync<ApiError>();
                Assert.Equal($"Invalid action verb.", content.Error);
            }
        }
        public async Task CreateActionWithInvalidGoalId()
        {
            var session = await Login();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id.ToString());

                var newAction = await CreateTestAction();

                var actionForm = new Action
                {
                    Verb = "testerVerb",
                    ActivityId = newAction.ActivityId,
                    GoalId = new Guid()
                };

                var actionResponse = await client.PostAsJsonAsync("/api/actions", actionForm);
                Assert.Equal(HttpStatusCode.NotFound, actionResponse.StatusCode);

                var content = await actionResponse.Content.ReadAsJsonAsync<ApiError>();
                Assert.Equal($"No Goal found", content.Error);
            }
        }
        public async Task CreateActionRelationWithInvalidActionId()
        {
            var session = await Login();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id.ToString());

                var newAR = new ActionRelation
                {
                    ActionId = new Guid(),
                    Relationship = 0,
                    ConcernChange = new Matrix { X = 0, Y = 0 },
                    RewardResourceChange = new Matrix { X = 0, Y = 0 }
                };
                var arResponse = await client.PostAsJsonAsync("/api/actions/relations", newAR);
                Assert.Equal(HttpStatusCode.NotFound, arResponse.StatusCode);

                var content = await arResponse.Content.ReadAsJsonAsync<ApiError>();
                Assert.Equal($"No Action found", content.Error);
            }
        }
        public async Task CreateGroup_WithNoPlayer()
        {
            var session = await Login();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id);

                var currentSeed = Guid.NewGuid();
                var form = new GroupFrom { Name = $"Test.{currentSeed}", Players = new List<Guid>() };

                // Create Group with No Player
                var groupResponse = await client.PostAsJsonAsync($"/api/groups", form);
                Assert.Equal(HttpStatusCode.BadRequest, groupResponse.StatusCode);

                var content = await groupResponse.Content.ReadAsJsonAsync<ApiError>();
                Assert.Equal("Group requires minimum 1 Player.", content.Error);
            }
        }
        public async Task UpdateInvalidAction()
        {
            var session = await Login();
            var invalidId = Guid.NewGuid();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id.ToString());

                var newAction = await CreateTestAction();

                var actionForm = new Action
                {
                    Verb = "testerVerb",
                    ActivityId = newAction.ActivityId,
                    GoalId = newAction.GoalId
                };

                // Get action with Invalid Id
                var actionResponse = await client.PutAsJsonAsync($"/api/actions/{invalidId}", actionForm);
                Assert.Equal(HttpStatusCode.NotFound, actionResponse.StatusCode);

                var content = await actionResponse.Content.ReadAsJsonAsync<ApiError>();
                Assert.Equal($"No such Action found.", content.Error);
            }
        }
        public async Task CreateGroup_WithInvalidPlayers()
        {
            var session = await Login();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id);

                var currentSeed = Guid.NewGuid();
                var invalidPlayer = Guid.NewGuid();
                var form = new GroupFrom
                {
                    Name = $"Test.{currentSeed}",
                    Players = new List<Guid> { session.Player.Id, invalidPlayer }
                };

                // Create Group with Invalid Players
                var groupResponse = await client.PostAsJsonAsync($"/api/groups", form);
                Assert.Equal(HttpStatusCode.NotFound, groupResponse.StatusCode);

                var content = await groupResponse.Content.ReadAsJsonAsync<ApiError>();
                Assert.Equal($"No Player with Id {invalidPlayer} exists.", content.Error);
            }
        }
        public async Task GetAllActions()
        {
            var session = await Login();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id.ToString());

                // Get actions
                var actionResponse = await client.GetAsync($"/api/actions");
                Assert.Equal(HttpStatusCode.OK, actionResponse.StatusCode);

                var actions = await actionResponse.Content.ReadAsJsonAsync<IList<Action>>();
                Assert.IsType(typeof(List<Action>), actions);
            }
        }
        public async Task UpdateGroupPlayer_WithInvalidGroup()
        {
            var session = await Login();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id);

                var form = new GroupFrom();

                // Update Group Players with Invalid Group Id
                var invalidId = Guid.NewGuid();
                var groupResponse = await client.PutAsJsonAsync($"/api/groups/{invalidId}/players/{invalidId}", form);
                Assert.Equal(HttpStatusCode.NotFound, groupResponse.StatusCode);

                var content = await groupResponse.Content.ReadAsJsonAsync<ApiError>();
                Assert.Equal("No Group found.", content.Error);
            }
        }
        public async Task DeleteValidPlayer()
        {
            var session = await Login();
            var currentSeed = Guid.NewGuid();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id);

                var form = new UserForm
                {
                    Username = $"Test.{currentSeed}",
                    Email = $"test.{currentSeed}@playgen.com",
                    Password = "******"
                };

                // Add Player with valid data
                var playerResponse = await client.PostAsJsonAsync($"/api/players", form);
                Assert.Equal(HttpStatusCode.Created, playerResponse.StatusCode);

                var player = await playerResponse.Content.ReadAsJsonAsync<Player>();
                Assert.Equal($"Test.{currentSeed}", player.Username);

                // Delete Player
                playerResponse = await client.DeleteAsync($"/api/players/{player.Id}");
                Assert.Equal(HttpStatusCode.OK, playerResponse.StatusCode);

                player = await playerResponse.Content.ReadAsJsonAsync<Player>();
                Assert.False(player.IsEnabled);
            }
        }
        public async Task UpdateGroupPlayer_RemoveExistingPlayer()
        {
            var mayur = await Login();
            var matt = await Login("matt", "matt");

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(mayur.Id);

                var currentSeed = Guid.NewGuid();
                var form = new GroupFrom
                {
                    Name = $"Test.{currentSeed}",
                    Type = GroupVisibility.Invisible,
                    Players = new List<Guid> { mayur.Player.Id, matt.Player.Id }
                };

                // Create Group with valid Players
                var groupResponse = await client.PostAsJsonAsync($"/api/groups", form);
                Assert.Equal(HttpStatusCode.Created, groupResponse.StatusCode);

                var group = await groupResponse.Content.ReadAsJsonAsync<Group>();
                Assert.IsType(typeof(Group), group);
                Assert.Equal(mayur.Player.Id, group.AdminId);

                var updateForm = new GroupFrom();

                // Update Group Players with Remove Existing Player
                groupResponse =
                    await client.PutAsJsonAsync($"/api/groups/{group.Id}/players/{matt.Player.Id}/remove", updateForm);
                Assert.Equal(HttpStatusCode.OK, groupResponse.StatusCode);

                var response = await groupResponse.Content.ReadAsJsonAsync<Group>();
                Assert.IsType(typeof(Group), response);
                Assert.Equal(group.Id, response.Id);
                Assert.Equal($"Test.{currentSeed}", response.Username);
                Assert.Equal(1, response.Players.Count);
            }
        }
        public async Task UpdateGroupPlayer_ExistingAdmin()
        {
            var mayur = await Login();
            var matt = await Login("matt", "matt");

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(mayur.Id);

                var currentSeed = Guid.NewGuid();
                var form = new GroupFrom
                {
                    Name = $"Test.{currentSeed}",
                    Type = GroupVisibility.Invisible,
                    Players = new List<Guid> { mayur.Player.Id, matt.Player.Id }
                };

                // Create Group with valid Players
                var groupResponse = await client.PostAsJsonAsync($"/api/groups", form);
                Assert.Equal(HttpStatusCode.Created, groupResponse.StatusCode);

                var group = await groupResponse.Content.ReadAsJsonAsync<Group>();
                Assert.IsType(typeof(Group), group);
                Assert.Equal(mayur.Player.Id, group.AdminId);

                var updateForm = new GroupFrom();

                // Update Group Players with Same Admin
                groupResponse =
                    await client.PutAsJsonAsync($"/api/groups/{group.Id}/players/{mayur.Player.Id}/admin", updateForm);
                Assert.Equal(HttpStatusCode.BadRequest, groupResponse.StatusCode);

                var content = await groupResponse.Content.ReadAsJsonAsync<ApiError>();
                Assert.Equal($"You are already Admin of this Group.", content.Error);
            }
        }
        public async Task UpdateRewardByValidAction()
        {
            var session = await Login();
            var newAction = await CreateTestAction("Verb test" + Guid.NewGuid());

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id.ToString());

                var newAT = new AttributeType { Name = "testAttribute", DefaultValue = 0f, Type = 0 };
                var atResponse = await client.PostAsJsonAsync("/api/attributes/types", newAT);
                Assert.Equal(HttpStatusCode.Created, atResponse.StatusCode);
                var attribute = await atResponse.Content.ReadAsJsonAsync<AttributeType>();
                var newAR = new ActionRelation
                {
                    ActionId = newAction.Id,
                    Relationship = 0,
                    ConcernChange = new Matrix { X = 0, Y = 0 },
                    RewardResourceChange = new Matrix { X = 0, Y = 0 }
                };
                var arResponse = await client.PostAsJsonAsync("/api/actions/relations", newAR);
                Assert.Equal(HttpStatusCode.Created, arResponse.StatusCode);
                var arReturn = await arResponse.Content.ReadAsJsonAsync<ActionRelation>();
                Assert.IsType(typeof(ActionRelation), arReturn);
                var newReward = new Reward
                {
                    AttributeTypeId = attribute.Id,
                    TypeReward = RewardType.Store,
                    Value = 1.5f,
                    Status = 0,
                    GoalId = newAction.GoalId
                };
                var rewardResponse = await client.PostAsJsonAsync("/api/rewards", newReward);
                Assert.Equal(HttpStatusCode.Created, rewardResponse.StatusCode);
                var newReward2 = new Reward
                {
                    AttributeTypeId = attribute.Id,
                    TypeReward = RewardType.Modify,
                    Value = 1f,
                    Status = 0,
                    GoalId = newAction.GoalId,
                    ActionRelationId = arReturn.Id
                };
                var rewardResponse2 = await client.PostAsJsonAsync("/api/rewards", newReward2);
                Assert.Equal(HttpStatusCode.Created, rewardResponse2.StatusCode);

                var actionForm = new Action { Verb = newAction.Verb };

                var actionResponse = await client.PostAsJsonAsync("/api/actions/send", actionForm);
                Assert.Equal(HttpStatusCode.OK, actionResponse.StatusCode);

                var rewardReturn = await actionResponse.Content.ReadAsJsonAsync<Reward>();
                Assert.IsType(typeof(Reward), rewardReturn);
            }
        }
        public async Task DisableGroup()
        {
            var mayur = await Login();
            var matt = await Login("matt", "matt");

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(mayur.Id);

                var currentSeed = Guid.NewGuid();
                var form = new GroupFrom
                {
                    Name = $"Test.{currentSeed}",
                    Type = GroupVisibility.Invisible,
                    Players = new List<Guid> { mayur.Player.Id, matt.Player.Id }
                };

                // Create Group with valid Players
                var groupResponse = await client.PostAsJsonAsync($"/api/groups", form);
                Assert.Equal(HttpStatusCode.Created, groupResponse.StatusCode);

                var group = await groupResponse.Content.ReadAsJsonAsync<Group>();
                Assert.IsType(typeof(Group), group);
                Assert.Equal(mayur.Player.Id, group.AdminId);

                // Get Group with valid id
                groupResponse = await client.DeleteAsync($"/api/groups/{group.Id}");
                Assert.Equal(HttpStatusCode.OK, groupResponse.StatusCode);

                var response = await groupResponse.Content.ReadAsJsonAsync<Group>();
                Assert.IsType(typeof(Group), response);
                Assert.Equal(group.Id, response.Id);
                Assert.False(response.IsEnabled);
            }
        }
        public async Task DisableGroup_InvalidGroup()
        {
            var session = await Login();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id);

                // Create Group with No Player
                var invalidId = Guid.NewGuid();
                var groupResponse = await client.DeleteAsync($"/api/groups/{invalidId}");
                Assert.Equal(HttpStatusCode.NotFound, groupResponse.StatusCode);

                var content = await groupResponse.Content.ReadAsJsonAsync<ApiError>();
                Assert.Equal("No Group found.", content.Error);
            }
        }
        public async Task DeleteValidAction()
        {
            var session = await Login();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id.ToString());

                var newAction = await CreateTestAction();

                var actionForm = new Action
                {
                    Verb = "testerVerb",
                    ActivityId = newAction.ActivityId,
                    GoalId = newAction.GoalId
                };

                var actionResponse = await client.PostAsJsonAsync("/api/actions", actionForm);
                Assert.Equal(HttpStatusCode.Created, actionResponse.StatusCode);

                var action = await actionResponse.Content.ReadAsJsonAsync<Action>();
                Assert.IsType(typeof(Action), action);

                var actionResponse2 = await client.DeleteAsync($"/api/actions/{action.Id}");
                Assert.Equal(HttpStatusCode.OK, actionResponse2.StatusCode);

                var actions = await actionResponse2.Content.ReadAsJsonAsync<Action>();
                Assert.IsType(typeof(Action), actions);
            }
        }
        public async Task UpdatePlayerWithExistingEmail()
        {
            var session = await Login();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id);

                var form = new UserForm { Email = "*****@*****.**" };

                // Update Player with existing Email
                var playerResponse = await client.PutAsJsonAsync($"/api/players/{session.Player.Id}", form);
                Assert.Equal(HttpStatusCode.BadRequest, playerResponse.StatusCode);

                var content = await playerResponse.Content.ReadAsJsonAsync<ApiError>();
                Assert.Equal("Player with this Email already exists.", content.Error);
            }
        }
        public async Task GetInvalidActionRelationWithNonExistingSession()
        {
            var sessionId = Guid.NewGuid();
            var invalidId = Guid.NewGuid();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(sessionId.ToString());

                // Get action with Invalid Id
                var actionResponse = await client.GetAsync($"/api/actions/{invalidId}/relations");
                Assert.Equal(HttpStatusCode.NotFound, actionResponse.StatusCode);

                var fetched = await actionResponse.Content.ReadAsJsonAsync<ApiError>();
                Assert.Equal($"Session {sessionId} is Invalid.", fetched.Error);
            }
        }
        public async Task DeleteInvalidPlayer()
        {
            var session = await Login();

            using (var client = new HttpClient { BaseAddress = new Uri(ServerUrl) })
            {
                client.AcceptJson().AddSessionHeader(session.Id);

                // Delete Player with Invalid Id
                var invalidPlayerId = Guid.NewGuid();
                var playerResponse = await client.DeleteAsync($"/api/players/{invalidPlayerId}");
                Assert.Equal(HttpStatusCode.NotFound, playerResponse.StatusCode);

                var content = await playerResponse.Content.ReadAsJsonAsync<ApiError>();
                Assert.Equal($"No such Player found.", content.Error);
            }
        }