public void Prepare() { //you are added to var f = ApiTestHelper.TestGroup; //and some other dudes Task.Run(async () => { //arrange await ApiTestHelper.CreateTestUser(ApiTestHelper.TestUserGuid); await ApiTestHelper.CreateTestUser(ApiTestHelper.TestUserGuid2); await ApiTestHelper.CreateTestUser(ApiTestHelper.TestUserGuid3); var ds = new DataService(); var add0 = new DrinkerCycleRequest(PossibleActions.Add, ApiTestHelper.TestUser) { Name = ApiTestHelper.TestGroup }; var add1 = new DrinkerCycleRequest(PossibleActions.Add, ApiTestHelper.TestUserGuid) { Name = ApiTestHelper.TestGroup }; var add2 = new DrinkerCycleRequest(PossibleActions.Add, ApiTestHelper.TestUserGuid2) { Name = ApiTestHelper.TestGroup }; var add3 = new DrinkerCycleRequest(PossibleActions.Add, ApiTestHelper.TestUserGuid3) { Name = ApiTestHelper.TestGroup }; var check1 = new DrinkerCycleRequest(PossibleActions.Exists, ApiTestHelper.TestUserGuid3) { Name = ApiTestHelper.TestGroup }; //add0 var res = await ds.PostDrinkerCycle(add0); ApiAssertHelper.CheckBooleanResponse(res); //act //check if user is in group res = await ds.PostDrinkerCycle(check1); ApiAssertHelper.CheckBooleanResponse(res); //check if group is empty except drinker var cylces = await ds.GetDrinkerCycle(ApiTestHelper.TestUser); ZeroMembers(cylces); //add1 res = await ds.PostDrinkerCycle(add1); ApiAssertHelper.CheckBooleanResponse(res); //add2 res = await ds.PostDrinkerCycle(add2); ApiAssertHelper.CheckBooleanResponse(res); //add3 res = await ds.PostDrinkerCycle(add3); ApiAssertHelper.CheckBooleanResponse(res); //check if three drinkers are returned cylces = await ds.GetDrinkerCycle(ApiTestHelper.TestUser); ThreeMembers(cylces); }).GetAwaiter().GetResult(); }
public void Test() { //authenticate all users in the group in the application, afterwards run method Task.Run(async () => { //arrange var ds = new DataService(); //act //check1 var res = await ds.GetDrinkerCycle(ApiTestHelper.TestUserGuid); IsAuthenticated(res); //check2 res = await ds.GetDrinkerCycle(ApiTestHelper.TestUserGuid2); IsAuthenticated(res); //check3 res = await ds.GetDrinkerCycle(ApiTestHelper.TestUserGuid3); IsAuthenticated(res); }).GetAwaiter().GetResult(); }
public void Run() { //remove all test users from group and run this method Task.Run(async () => { //arrange var ds = new DataService(); //act //check1 var res = await ds.GetDrinkerCycle(ApiTestHelper.TestUserGuid); IsNotInGroup(res); //check2 res = await ds.GetDrinkerCycle(ApiTestHelper.TestUserGuid2); IsNotInGroup(res); //check3 res = await ds.GetDrinkerCycle(ApiTestHelper.TestUserGuid3); IsNotInGroup(res); }).GetAwaiter().GetResult(); }
public void DoLiveCycle() { Task.Run(async () => { //arrange await ApiTestHelper.CreateTestUser(ApiTestHelper.TestUserGuid); await ApiTestHelper.CreateTestUser(ApiTestHelper.TestUserGuid2); var ds = new DataService(); var exists = new DrinkerCycleRequest(PossibleActions.Exists, ApiTestHelper.TestUserGuid) { Name = ApiTestHelper.TestCycleGuid.ToString() }; var add1 = new DrinkerCycleRequest(PossibleActions.Add, ApiTestHelper.TestUserGuid) { Name = ApiTestHelper.TestCycleGuid.ToString() }; var remove1 = new DrinkerCycleRequest(PossibleActions.Remove, ApiTestHelper.TestUserGuid) { Name = ApiTestHelper.TestCycleGuid.ToString() }; var add2 = new DrinkerCycleRequest(PossibleActions.Add, ApiTestHelper.TestUserGuid2) { Name = ApiTestHelper.TestCycleGuid.ToString() }; var removeForeign2 = new DrinkerCycleRequest(PossibleActions.RemoveForeign, ApiTestHelper.TestUserGuid) { Name = ApiTestHelper.TestCycleGuid.ToString(), AuthGuid = ApiTestHelper.TestUserGuid2 }; var remove2 = new DrinkerCycleRequest(PossibleActions.Remove, ApiTestHelper.TestUserGuid2) { Name = ApiTestHelper.TestCycleGuid.ToString() }; var auth2 = new DrinkerCycleRequest(PossibleActions.Autheticate, ApiTestHelper.TestUserGuid) { Name = ApiTestHelper.TestCycleGuid.ToString(), AuthGuid = ApiTestHelper.TestUserGuid2 }; var invalidAuth2 = new DrinkerCycleRequest(PossibleActions.Autheticate, ApiTestHelper.TestUserGuid2) { Name = ApiTestHelper.TestCycleGuid.ToString(), AuthGuid = ApiTestHelper.TestUserGuid2 }; var deauth2 = new DrinkerCycleRequest(PossibleActions.Deautheticate, ApiTestHelper.TestUserGuid) { Name = ApiTestHelper.TestCycleGuid.ToString(), AuthGuid = ApiTestHelper.TestUserGuid2 }; var invalidDeauth2 = new DrinkerCycleRequest(PossibleActions.Deautheticate, ApiTestHelper.TestUserGuid2) { Name = ApiTestHelper.TestCycleGuid.ToString(), AuthGuid = ApiTestHelper.TestUserGuid }; //act //check if already exists; var res = await ds.PostDrinkerCycle(exists); ApiAssertHelper.CheckBooleanResponseForFalse(res); //add 1; res = await ds.PostDrinkerCycle(add1); ApiAssertHelper.CheckBooleanResponse(res); //check if exists; res = await ds.PostDrinkerCycle(exists); ApiAssertHelper.CheckBooleanResponse(res); //check if 1 is authenticated var cycles = await ds.GetDrinkerCycle(ApiTestHelper.TestUserGuid); CheckForEmptyCycle(cycles); //add 2; res = await ds.PostDrinkerCycle(add2); ApiAssertHelper.CheckBooleanResponse(res); //check if 2 is not authenticated cycles = await ds.GetDrinkerCycle(ApiTestHelper.TestUserGuid); CheckForNotAuthenticated(cycles); //invalid authenticate 2 res = await ds.PostDrinkerCycle(invalidAuth2); ApiAssertHelper.CheckBooleanResponseForFalse(res); //check if 2 is not authenticated cycles = await ds.GetDrinkerCycle(ApiTestHelper.TestUserGuid); CheckForNotAuthenticated(cycles); //valid authenticate 2 res = await ds.PostDrinkerCycle(auth2); ApiAssertHelper.CheckBooleanResponse(res); //check if 2 is authenticated cycles = await ds.GetDrinkerCycle(ApiTestHelper.TestUserGuid); CheckForAuthenticated(cycles); //removeforeign 2 res = await ds.PostDrinkerCycle(removeForeign2); ApiAssertHelper.CheckBooleanResponse(res); //check if 2 is removed cycles = await ds.GetDrinkerCycle(ApiTestHelper.TestUserGuid); CheckForEmptyCycle(cycles); //add 2 again & authenticate res = await ds.PostDrinkerCycle(add2); ApiAssertHelper.CheckBooleanResponse(res); res = await ds.PostDrinkerCycle(auth2); ApiAssertHelper.CheckBooleanResponse(res); //valid deauthenticate 2 res = await ds.PostDrinkerCycle(deauth2); ApiAssertHelper.CheckBooleanResponse(res); //check if 2 is not authenticated cycles = await ds.GetDrinkerCycle(ApiTestHelper.TestUserGuid); CheckForNotAuthenticated(cycles); //invalid deauthenticate 2 res = await ds.PostDrinkerCycle(invalidDeauth2); ApiAssertHelper.CheckBooleanResponseForFalse(res); //remove 2 again res = await ds.PostDrinkerCycle(remove2); ApiAssertHelper.CheckBooleanResponse(res); //check if 2 is not in group cycles = await ds.GetDrinkerCycle(ApiTestHelper.TestUserGuid); CheckForEmptyCycle(cycles); //add 1; res = await ds.PostDrinkerCycle(remove1); ApiAssertHelper.CheckBooleanResponse(res); //check if group gone again; res = await ds.PostDrinkerCycle(exists); ApiAssertHelper.CheckBooleanResponseForFalse(res); //clean await ApiTestHelper.DeleteTestUser(ApiTestHelper.TestUserGuid); await ApiTestHelper.DeleteTestUser(ApiTestHelper.TestUserGuid2); }).GetAwaiter().GetResult(); }