Exemplo n.º 1
0
        public void Create_Get_Edit_Delete_Collaborator()
        {
            if (string.IsNullOrWhiteSpace(CollaboratorEmail))
            {
                Assert.Inconclusive("Please specify a valid CollaboratorEmail, if you don't have one just uncomment the Ignore attribue");
            }

            EnsureApplication();

            var result = Api.CreateCollaborator(ApplicationSlug, CollaboratorEmail, Model.CollaboratorType.Collaborator);

            Assert.IsNotNull(result);
            Assert.AreNotEqual(0, result.Id);
            Assert.AreEqual(CreateStatus.Created, result.Status);

            var item = Api.GetCollaborator(ApplicationSlug, result.Id);

            Assert.IsNotNull(item);
            Assert.AreEqual(result.Id, item.Id);
            Assert.AreEqual(CollaboratorType.Collaborator, item.Role);

            item.Role = CollaboratorType.Administrator;
            var updated = Api.EditCollaborator(ApplicationSlug, item);

            Assert.IsTrue(updated);

            item = Api.GetCollaborator(ApplicationSlug, result.Id);
            Assert.IsNotNull(item);
            Assert.AreEqual(result.Id, item.Id);
            Assert.AreEqual(CollaboratorType.Administrator, item.Role);

            Api.DeleteCollaborator(ApplicationSlug, result.Id);
        }
Exemplo n.º 2
0
        public void Try_Create_Existing_Collaborator()
        {
            var createResult = ExistingDataDataApi.CreateCollaborator(ApplicationID, "*****@*****.**", CollaboratorType.Collaborator);

            Assert.IsNotNull(createResult);
            Assert.AreEqual(CreateStatus.AlreadyExists, createResult.Status);
            Assert.IsNull(createResult.Id);
            Assert.AreEqual(null, createResult.Location);
        }
Exemplo n.º 3
0
        public void Create_Non_Existing_Collaborator()
        {
            var createResult = Api.CreateCollaborator(ApplicationID, "*****@*****.**", CollaboratorType.Collaborator);

            Assert.IsNotNull(createResult);
            Assert.AreEqual(CreateStatus.Created, createResult.Status);
            Assert.AreEqual("5", createResult.Id);
            Assert.AreEqual("https://appharbor.com/applications/:application/collaborators/5", createResult.Location.AbsoluteUri);
        }