当前位置: 首页>>代码示例>>C#>>正文


C# DataService.GetDrinkerCycle方法代码示例

本文整理汇总了C#中DataService.GetDrinkerCycle方法的典型用法代码示例。如果您正苦于以下问题:C# DataService.GetDrinkerCycle方法的具体用法?C# DataService.GetDrinkerCycle怎么用?C# DataService.GetDrinkerCycle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataService的用法示例。


在下文中一共展示了DataService.GetDrinkerCycle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Prepare

        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();
        }
开发者ID:famoser,项目名称:BeerCompanion,代码行数:48,代码来源:GroupBehaviour.cs

示例2: Test

        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();
        }
开发者ID:famoser,项目名称:BeerCompanion,代码行数:22,代码来源:GroupBehaviour.cs

示例3: Run

        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();
        }
开发者ID:famoser,项目名称:BeerCompanion,代码行数:22,代码来源:GroupBehaviour.cs

示例4: DoLiveCycle

        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);
//.........这里部分代码省略.........
开发者ID:famoser,项目名称:BeerCompanion,代码行数:101,代码来源:DrinkerCycleRequests.cs


注:本文中的DataService.GetDrinkerCycle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。