예제 #1
0
        public void GetAllProjects_Success()
        {
            SetupResponse("api/components/search", RestResponseFactory.CreateGetProjects_ValidResponse());
            var service = new ComponentsClient(MockClient.Object);

            var expected = new List <SonarQubeProject>()
            {
                new SonarQubeProject {
                    Key = "ETAS:INCA:HWA:A1b:LIN", Name = "ETAS-INCA-HWA-A1b-LIN"
                },
                new SonarQubeProject {
                    Key = "ETAS:INCA:HWA:A1b:UDS", Name = "ETAS-INCA-HWA-A1b-UDS"
                },
                new SonarQubeProject {
                    Key = "ETAS:INCA:HWA:A1b:MT1To2", Name = "ETAS-INCA-HWA-A1b-MT1To2"
                }
            };

            var actual = service.GetAllProjects().Result;

            Assert.That(actual.Count, Is.EqualTo(expected.Count));

            for (var i = 0; i < actual.Count; ++i)
            {
                Assert.That(actual[i].Key, Is.EqualTo(expected[i].Key));
                Assert.That(actual[i].Name, Is.EqualTo(expected[i].Name));
            }
        }
예제 #2
0
 public SearchBilling()
 {
     customersClient  = new CustomersClient(serviceAddress);
     ordersClient     = new OrdersClient(serviceAddress);
     goodsClient      = new GoodsClient(serviceAddress);
     componentsClient = new ComponentsClient(serviceAddress);
 }
예제 #3
0
        public void GetAllProjects_NoProjects()
        {
            SetupResponse("api/components/search", RestResponseFactory.CreateComponentsResponse_NoProjects());
            var service = new ComponentsClient(MockClient.Object);

            var projects = service.GetAllProjects().Result;

            Assert.That(projects.Count, Is.EqualTo(0));
        }
예제 #4
0
        public async Task GetComponentAsync(string realm)
        {
            var components = await ComponentsClient.GetComponentsAsync(realm);

            string componentId = components.FirstOrDefault()?.Id;

            if (componentId != null)
            {
                var result = await ComponentsClient.GetComponentAsync(realm, componentId);

                Assert.NotNull(result);
            }
        }
예제 #5
0
        public async Task GetComponentsAsync(string realm)
        {
            var result = await ComponentsClient.GetComponentsAsync(realm);

            Assert.NotNull(result);
        }