Class with Project management api.
 public async Task New_WithoutName_ThrowsException(ProjectSyncanoClient client)
 {
     try
     {
         //when
         await client.New(null);
         throw new Exception("New should throw an exception");
     }
     catch (Exception e)
     {
         //then
         e.ShouldBeType<ArgumentNullException>();
     }
 }
        public async Task New_WithExistingName_ThrowsException(ProjectSyncanoClient client)
        {
            //given
            const string projectName = TestData.ProjectName;
            const string projectDescription = "qwerty";

            //when
            var project = await client.New(projectName, projectDescription);

            //then
            project.ShouldNotBeNull();
            project.Id.ShouldNotBeNull();
            project.Name.ShouldEqual(projectName);
            project.Description.ShouldEqual(projectDescription);

            //cleanup
            await client.Delete(project.Id);
        }
        public async Task New_WithoutDescription_CreatesNewProjectObject(ProjectSyncanoClient client)
        {
            //given
            string projectName = "NewProject test " + DateTime.Now.ToLongTimeString() + " " +
                                 DateTime.Now.ToShortDateString();

            //when
            var project = await client.New(projectName);

            //then
            project.ShouldNotBeNull();
            project.Id.ShouldNotBeNull();
            project.Name.ShouldEqual(projectName);
            project.Description.ShouldBeNull();

            //cleanup
            await client.Delete(project.Id);
        }
        public async Task Get_CreatesProjectsList(ProjectSyncanoClient client)
        {
            //when
            var response = await client.Get();

            //then
            response.ShouldNotBeEmpty();
            response.Any(p => p.Name == TestData.ProjectName).ShouldBeTrue();
        }
  public async Task Delete_WithInvalidProjectId_ThrowsException(ProjectSyncanoClient client)
 {
     try
     {
         //when
         await client.Delete("abcde");
         throw new Exception("Delete should throw an exception");
     }
     catch (Exception e)
     {
         //then
         e.ShouldBeType<SyncanoException>();
     }
 }
  public async Task Delete_WithNoProjectId_ThrowsException(ProjectSyncanoClient client)
 {
     try
     {
         //when
         await client.Delete(null);
         throw new Exception("Delete should throw an exception");
     }
     catch (Exception e)
     {
         //then
         e.ShouldBeType<ArgumentNullException>();
     }
 }
         public async Task Delete_RemovesProject(ProjectSyncanoClient client)
        {
            //given
            string projectName = "NewProject test " + DateTime.Now.ToLongTimeString() + " " +
                                 DateTime.Now.ToShortDateString();
            const string projectDescription = "qwerty";
            var project = await client.New(projectName, projectDescription);

            //when
            var result = await client.Delete(project.Id);

            //then
            result.ShouldBeTrue();
        }
 public async Task Deauthorize_WithInvalidProjectId_ThrowsException(ProjectSyncanoClient client)
 {
     try
     {
         //when
         await client.Deauthorize(TestData.UserApiClientId, Permissions.CreateData, "abcde");
         throw new Exception("Deauthorize should throw an exception");
     }
     catch (Exception e)
     {
         //then
         e.ShouldBeType<SyncanoException>();
     }
 }
 public async Task Deauthorize_WithNoUserApiKey_ThrowsException(ProjectSyncanoClient client)
 {
     try
     {
         //when
         await client.Deauthorize(null, Permissions.CreateData, TestData.ProjectId);
         throw new Exception("Deauthorize should throw an exception");
     }
     catch (Exception e)
     {
         //then
         e.ShouldBeType<ArgumentNullException>();
     }
 }
        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);
        }
 public async Task Authorize_WithNoProjectId_ThrowsException(ProjectSyncanoClient client)
 {
     try
     {
         //when
         await client.Authorize(TestData.UserApiClientId, Permissions.CreateData, null);
         throw new Exception("Authorize should throw an exception");
     }
     catch (Exception e)
     {
         //then
         e.ShouldBeType<ArgumentNullException>();
     }
 }
 public async Task Authorize_WithInvalidUserApiKey_ThrowsException(ProjectSyncanoClient client)
 {
     try
     {
         //when
         await client.Authorize("abcde", Permissions.CreateData, TestData.ProjectId);
         throw new Exception("Authorize should throw an exception");
     }
     catch (Exception e)
     {
         //then
         e.ShouldBeType<SyncanoException>();
     }
 }
        public async Task Update_WithNoNewValues(ProjectSyncanoClient client)
        {
            //given
            string projectName = "UpdateProject test " + DateTime.Now.ToLongTimeString() + " " +
                                 DateTime.Now.ToShortDateString();

            var project = await client.New(projectName);

            //when
            project = await client.Update(project.Id);

            //then
            project.ShouldNotBeNull();
            project.Name.ShouldEqual(projectName);
            project.Description.ShouldBeNull();

            //cleanup
            await client.Delete(project.Id);
        }
        public async Task Update_CreatesProjectObjectWithNewValues(ProjectSyncanoClient client)
        {
            //given
            var projectName = "UpdateProject test " + DateTime.Now.ToLongTimeString() + " " +
                                 DateTime.Now.ToShortDateString();
            var projectNewName = "UpdateProject test new name" + DateTime.Now.ToLongTimeString() + " " +
                                 DateTime.Now.ToShortDateString();
            const string projectOldDescription = "qwerty";
            const string projectNewDescription = "abc";
            var project = await client.New(projectName, projectOldDescription);

            //when
            project = await client.Update(project.Id, projectNewName, projectNewDescription);
            
            //then
            project.ShouldNotBeNull();
            project.Name.ShouldEqual(projectNewName);
            project.Description.ShouldEqual(projectNewDescription);

            //cleanup
            await client.Delete(project.Id);
        }
        public async Task GetOne_GetsProjectObject(ProjectSyncanoClient client)
        {
            //when
            var project = await client.GetOne(TestData.ProjectId);

            //then
            project.Id.ShouldEqual(TestData.ProjectId);
            project.Name.ShouldEqual(TestData.ProjectName);
            project.Name.ShouldNotBeNull();
        }
        public async Task Get_CreatesProjectsList_MultipleProjects(ProjectSyncanoClient client)
        {
            //given
            const int count = 10;
            for (int i = 0; i < count; ++i)
                await client.New("Test project " + i);

            //when
            var response = await client.Get();

            //then
            response.ShouldNotBeEmpty();
            response.Any(p => p.Name == TestData.ProjectName).ShouldBeTrue();
            response.Count.ShouldEqual(count+1);

            //cleanup
            foreach (var project in response)
            {
                if(project.Id != TestData.ProjectId)
                    await client.Delete(project.Id);
            }
        }