Ejemplo n.º 1
0
            public void PostsToTheCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new PipelinesClient(connection);

                var newPipeline = new NewPipeline("name");

                client.Create(newPipeline);

                connection.Received().Post <Pipeline>(Arg.Is <Uri>(u => u.ToString() == "pipelines"),
                                                      Arg.Is <NewPipeline>(nc => nc.Name == "name"));
            }
            public async Task CanCreate()
            {
                var pipedrive = Helper.GetAuthenticatedClient();
                var fixture   = pipedrive.Pipeline;

                var newPipeline = new NewPipeline("name");

                newPipeline.Active = true;

                var pipeline = await fixture.Create(newPipeline);

                Assert.NotNull(pipeline);

                // Cleanup
                await fixture.Delete(pipeline.Id);
            }
Ejemplo n.º 3
0
        public void TestCreatePipeline()
        {
            var newPipeline = new NewPipeline()
            {
                Name  = "New Pipeline",
                Tools = new List <string>()
            };
            var request = new CreatePipelineRequest
            {
                Pipeline = newPipeline
            };
            var pipelineCountBeforeInsert = _mockPipelineService.GetPipelines().Pipelines.Count;

            _mockPipelineService.CreatePipeline(request);
            var pipelineCountAfterInsert = _mockPipelineService.GetPipelines().Pipelines.Count;

            Assert.NotEqual(pipelineCountBeforeInsert, pipelineCountAfterInsert);
        }
            public async Task CanDelete()
            {
                var pipedrive = Helper.GetAuthenticatedClient();
                var fixture   = pipedrive.Pipeline;

                var newPipeline = new NewPipeline("new-name");

                newPipeline.Active = true;
                var pipeline = await fixture.Create(newPipeline);

                var createdPipeline = await fixture.Get(pipeline.Id);

                Assert.NotNull(createdPipeline);

                await fixture.Delete(createdPipeline.Id);

                var deletedPipeline = await fixture.Get(pipeline.Id);

                Assert.False(deletedPipeline.Active);
            }
            public async Task CanEdit()
            {
                var pipedrive = Helper.GetAuthenticatedClient();
                var fixture   = pipedrive.Pipeline;

                var newPipeline = new NewPipeline("new-name");
                var pipeline    = await fixture.Create(newPipeline);

                var editPipeline = pipeline.ToUpdate();

                editPipeline.Name   = "updated-name";
                editPipeline.Active = true;

                var updatedPipeline = await fixture.Edit(pipeline.Id, editPipeline);

                Assert.Equal("updated-name", updatedPipeline.Name);
                Assert.True(updatedPipeline.Active);

                // Cleanup
                await fixture.Delete(updatedPipeline.Id);
            }