Exemplo n.º 1
0
        public void Get_applications_should_not_return_null()
        {
            //Arrange
            Uri            executingUrl   = Helpers.UriHelper.GetMethodPath(AppSettings.NewRelic.BaseUrl, AppSettings.NewRelic.Version, AppSettings.NewRelic.ApplicationPath);
            ListDictionary requestHeaders = new ListDictionary {
                { "X-Api-Key", AppSettings.NewRelic.ApiKey }
            };

            //Act
            string httpGetResult = FetchData.HttpGet(executingUrl, requestHeaders).Result;
            ApplicationResponse deserializedObject = JsonConvert.DeserializeObject <ApplicationResponse>(httpGetResult);

            // Assert
            Assert.IsNotNull(deserializedObject.Applications);
        }
Exemplo n.º 2
0
        public void Get_site_by_id_health_status_should_be_gray_when_application_is_down()
        {
            var method = "applications";
            var expectedValueWhenApplicationHasError = "gray";

            //Arrange
            Uri            executingUrl   = Helpers.UriHelper.GetMethodPath(AppSettings.NewRelic.BaseUrl, AppSettings.NewRelic.Version, method, AppSettings.NewRelic.DummyApplication);
            ListDictionary requestHeaders = new ListDictionary {
                { "X-Api-Key", AppSettings.NewRelic.ApiKey }
            };

            //Act
            string httpGetResult = FetchData.HttpGet(executingUrl, requestHeaders).Result;
            ApplicationResponse deserializedObject = JsonConvert.DeserializeObject <ApplicationResponse>(httpGetResult);

            // Assert
            Assert.AreEqual(expectedValueWhenApplicationHasError, deserializedObject.Application.HealthStatus);
        }
Exemplo n.º 3
0
        public void Get_users_should_not_return_null()
        {
            const string userMethod = "users";

            // Arrange
            LoginResult deserializedTokenObject = GetToken();
            Uri         executingUrl            = Helpers.UriHelper.GetMethodPath(AppSettings.AzureAD.BaseUrl, AppSettings.AzureAD.Domain,
                                                                                  null, userMethod, null, AppSettings.AzureAD.ApiVersion16);

            ListDictionary requestHeaders = new ListDictionary {
                { "Authorization", "Bearer " + deserializedTokenObject.AccessToken },
                { "Content-Type", AppSettings.AzureAD.ContentType },
            };

            // Act
            string     httpGetResult      = FetchData.HttpGet(executingUrl, requestHeaders).Result;
            UserResult deserializedObject = JsonConvert.DeserializeObject <UserResult>(httpGetResult);

            // Assert
            Assert.IsNotNull(deserializedObject.Users);
        }