Пример #1
0
        public async Task Authorize_WithInvalidProjectId_ThrowsException(ProjectSyncanoClient client)
        {
            try
            {
                //when
                await client.Authorize(TestData.UserApiClientId, Permissions.CreateData, "abcde");

                throw new Exception("Authorize should throw an exception");
            }
            catch (Exception e)
            {
                //then
                e.ShouldBeType <SyncanoException>();
            }
        }
Пример #2
0
        public async Task Authorize_WithNoUserApiKey_ThrowsException(ProjectSyncanoClient client)
        {
            try
            {
                //when
                await client.Authorize(null, Permissions.CreateData, TestData.ProjectId);

                throw new Exception("Authorize should throw an exception");
            }
            catch (Exception e)
            {
                //then
                e.ShouldBeType <ArgumentNullException>();
            }
        }
Пример #3
0
        public async Task Deauthorize_WithReadDataPermissions(ProjectSyncanoClient client)
        {
            //given
            string projectName = "Deauthorize Test " + DateTime.Now.ToLongTimeString() + " " +
                                 DateTime.Now.ToShortDateString();

            var project = await client.New(projectName);

            await client.Authorize(TestData.UserApiClientId, Permissions.ReadData, project.Id);

            //when
            var result = await client.Deauthorize(TestData.UserApiClientId, Permissions.ReadData, project.Id);

            //then
            result.ShouldBeTrue();

            //cleanup
            await client.Delete(project.Id);
        }