Esempio n. 1
0
        public void DoLiveCycle()
        {
            Task.Run(async () =>
            {
                //arrange
                var usrInfo = new UserInformationEntity()
                {
                    Color = "AF56EB",
                    Name = "TestUser"
                };
                var updateDrinkRequest = new DrinkerRequest(PossibleActions.Update, ApiTestHelper.TestUserGuid)
                {
                    UserInformations = usrInfo
                };
                var existDrinkRequest = new DrinkerRequest(PossibleActions.Exists, ApiTestHelper.TestUserGuid)
                {
                    UserInformations = usrInfo
                };
                var removeDrinkRequest = new DrinkerRequest(PossibleActions.Remove, ApiTestHelper.TestUserGuid)
                {
                    UserInformations = usrInfo
                };
                var ds = new DataService();

                //act
                //check if already exists;
                var res = await ds.PostDrinker(existDrinkRequest);
                ApiAssertHelper.CheckBooleanResponseForFalse(res);

                //add
                res = await ds.PostDrinker(updateDrinkRequest);
                ApiAssertHelper.CheckBooleanResponse(res);

                //check for existence
                var drinker = await ds.GetDrinker(ApiTestHelper.TestUserGuid);
                CheckGetDrinkerResponse(drinker, updateDrinkRequest);

                //update
                updateDrinkRequest.UserInformations.Name = "NewName";
                updateDrinkRequest.UserInformations.Color = "NewColor";
                res = await ds.PostDrinker(updateDrinkRequest);
                ApiAssertHelper.CheckBooleanResponse(res);

                //check for updated values
                drinker = await ds.GetDrinker(ApiTestHelper.TestUserGuid);
                CheckGetDrinkerResponse(drinker, updateDrinkRequest);

                //delete drinker again
                res = await ds.PostDrinker(removeDrinkRequest);
                ApiAssertHelper.CheckBooleanResponse(res);

                //ensure Drinker is deleted;
                res = await ds.PostDrinker(existDrinkRequest);
                ApiAssertHelper.CheckBooleanResponseForFalse(res);
            }).GetAwaiter().GetResult();
        }
Esempio n. 2
0
 public static async Task CreateTestUser(Guid guid)
 {
     var ds = new DataService();
     //arrange
     var usrInfo = new UserInformationEntity()
     {
         Color = "AF56EB",
         Name = "TestUser"
     };
     var updateDrinkRequest = new DrinkerRequest(PossibleActions.Update, guid)
     {
         UserInformations = usrInfo
     };
     ApiAssertHelper.CheckBooleanResponse(await ds.PostDrinker(updateDrinkRequest));
 }