Exemple #1
0
            public void Should_Throw_On_Null_Settings_Parameter()
            {
                //Given
                HttpSettings settings    = null;
                string       requestBody = "{ \"id\":0, \"name\": \"testing\"}";

                //When
                var record = Record.Exception(() => HttpSettingsExtensions.SetRequestBody(settings, requestBody));

                //Then
                CakeAssert.IsArgumentNullException(record, "settings");
            }
Exemple #2
0
            public void Should_Throw_On_Null_Or_Empty_RequestBody_Parameter()
            {
                //Given
                HttpSettings settings    = new HttpSettings();
                string       requestBody = null;

                //When
                requestBody = null;
                var nullRecord = Record.Exception(() => HttpSettingsExtensions.SetRequestBody(settings, requestBody));

                requestBody = string.Empty;
                var emptyRecord = Record.Exception(() => HttpSettingsExtensions.SetRequestBody(settings, requestBody));

                requestBody = "      ";
                var spaceRecord = Record.Exception(() => HttpSettingsExtensions.SetRequestBody(settings, requestBody));

                //Then
                CakeAssert.IsArgumentNullException(nullRecord, nameof(requestBody));
                CakeAssert.IsArgumentNullException(emptyRecord, nameof(requestBody));
                CakeAssert.IsArgumentNullException(spaceRecord, nameof(requestBody));
            }