public void Should_Throw_On_Null_Settings_Parameter()
            {
                //Given
                SsrsConnectionSettings settings = null;

                //When
                var nullRecord = Record.Exception(() => SsrsConnectionSettingsExtensions.UseDefaultCredientials(settings));

                //Then
                CakeAssert.IsArgumentNullException(nullRecord, nameof(settings));
            }
示例#2
0
            public void Should_Throw_On_Null_Settings_Parameter()
            {
                //Given
                HttpSettings settings = null;

                //When
                var nullRecord = Record.Exception(() => HttpSettingsExtensions.EnsureSuccessStatusCode(settings));

                //Then
                CakeAssert.IsArgumentNullException(nullRecord, "settings");
            }
示例#3
0
            public void Should_Throw_On_Null_Or_Empty_Data_Parameter()
            {
                //Given
                HttpSettings settings = new HttpSettings();
                BodyModel    data     = null;

                //When
                var actual = Record.Exception(() => HttpSettingsExtensions.SetJsonRequestBody(settings, data));

                //Then
                CakeAssert.IsArgumentNullException(actual, nameof(data));
            }
示例#4
0
            public void Should_Throw_On_Null_Or_Empty_Data_Parameter()
            {
                //Given
                HttpSettings settings             = new HttpSettings();
                IDictionary <string, string> data = null;

                //When
                var nullRecord = Record.Exception(() => HttpSettingsExtensions.SetFormUrlEncodedRequestBody(settings, data));

                //Then
                CakeAssert.IsArgumentNullException(nullRecord, nameof(data));
            }
            public void Should_Throw_On_Null_ServiceEndpoint_Parameter()
            {
                //Given
                SsrsConnectionSettings settings = new SsrsConnectionSettings();
                string serviceEndpoint          = "";

                //When
                var record = Record.Exception(() => SsrsConnectionSettingsExtensions.SetServiceEndpoint(settings, serviceEndpoint));

                //Then
                CakeAssert.IsArgumentNullException(record, nameof(serviceEndpoint));
            }
            public void Should_Throw_On_Invalid_ServiceEndpoint_Url_Parameter()
            {
                //Given
                SsrsConnectionSettings settings = new SsrsConnectionSettings();
                string serviceEndpoint          = "ftp://localhost/reportserver/ReportService2010.asmx";

                //When
                var record = Record.Exception(() => SsrsConnectionSettingsExtensions.SetServiceEndpoint(settings, serviceEndpoint));

                //Then
                CakeAssert.IsExceptionWithMessage <UriFormatException>(record, $"{ nameof(serviceEndpoint) } is not a valid http or https scheme url.");
            }
示例#7
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");
            }
示例#8
0
            public void Should_Throw_On_Null_Settings_Parameter()
            {
                //Given
                HttpSettings settings = null;
                string       name     = "Content-Type";
                string       value    = "applicaion/json";

                //When
                var record = Record.Exception(() => HttpSettingsExtensions.AppendHeader(settings, name, value));

                //Then
                CakeAssert.IsArgumentNullException(record, "settings");
            }
示例#9
0
            public void Should_Throw_On_Null_Settings_Parameter()
            {
                //Given
                HttpSettings settings = null;
                string       name     = "sessionid";
                string       value    = "1BA9481B-74C1-42B3-A1B9-0B914BAE0F05";

                //When
                var record = Record.Exception(() => HttpSettingsExtensions.AppendCookie(settings, name, value));

                //Then
                CakeAssert.IsArgumentNullException(record, "settings");
            }
            public void Should_Throw_On_Null_Or_Empty_Context_Parameter()
            {
                //Given
                ICakeContext context  = null;
                string       address  = RootAddress;
                HttpSettings settings = new HttpSettings();

                //When
                var nullRecord = Record.Exception(() => HttpClientAliases.HttpDelete(context, address, settings));

                //Then
                CakeAssert.IsArgumentNullException(nullRecord, nameof(context));
            }
            public void Should_Throw_On_Null_Settings_Parameter()
            {
                //Given
                ICakeContext context  = _Context;
                string       address  = RootAddress;
                HttpSettings settings = null;

                //When
                var record = Record.Exception(() => HttpClientAliases.HttpGetAsByteArray(context, address, settings));

                //Then
                CakeAssert.IsArgumentNullException(record, nameof(settings));
            }
示例#12
0
            public void Should_Throw_On_Null_Argument()
            {
                //Given
                var settings = new HttpSettings();

                X509Certificate2[] clientCertificates = null;

                //When
                var nullRecord = Record.Exception(() => settings.UseClientCertificates(clientCertificates));

                //Then
                CakeAssert.IsArgumentNullException(nullRecord, nameof(clientCertificates));
            }
示例#13
0
            public void Should_Throw_On_Null_Settings_Parameter()
            {
                //Given
                HttpSettings settings = null;
                BodyModel    model    = new BodyModel {
                    Id = 1234567, Active = true, name = "Rob Test"
                };

                //When
                var record = Record.Exception(() => HttpSettingsExtensions.SetJsonRequestBody(settings, model));

                //Then
                CakeAssert.IsArgumentNullException(record, "settings");
            }
            public void Should_Throw_On_Null_Or_Empty_Address_Parameter()
            {
                //Given
                ICakeContext context    = _Context;
                HttpSettings settings   = new HttpSettings();
                string       address    = null;
                string       httpMethod = "POST";

                //When
                var nullRecord = Record.Exception(() => HttpClientAliases.HttpSend(context, address, httpMethod, settings));

                //Then
                CakeAssert.IsArgumentNullException(nullRecord, nameof(address));
            }
示例#15
0
            public void Should_Throw_On_Null_Or_Empty_Request_Parameter()
            {
                //Given
                ICakeContext           context  = _Context;
                SsrsConnectionSettings settings = _Settings;
                FindItemRequest        request  = null;


                //When
                var record = Record.Exception(() => SsrsAliases.SsrsFindItem(context, request, settings));

                //Then
                CakeAssert.IsArgumentNullException(record, nameof(request));
            }
示例#16
0
            public void Should_Throw_On_Null_FolderName_Context()
            {
                //Given
                ICakeContext           context  = _Context;
                SsrsConnectionSettings settings = _Settings;
                string folderName   = string.Empty;
                string parentFolder = null;

                //When
                var record = Record.Exception(() => SsrsAliases.SsrsCreateFolder(context, folderName, parentFolder, settings));

                //Then
                CakeAssert.IsArgumentNullException(record, nameof(folderName));
            }
            public void Should_Throw_On_Null_Password_Parameter()
            {
                //Given
                SsrsConnectionSettings settings = new SsrsConnectionSettings();

                string userName = "******";
                string password = string.Empty;
                string domain   = "MICROSOFT";

                //When
                var nullRecord = Record.Exception(() => SsrsConnectionSettingsExtensions.AuthenticateWith(settings, userName, password, domain));

                //Then
                CakeAssert.IsArgumentNullException(nullRecord, nameof(password));
            }
示例#18
0
            public void Should_Throw_On_Null_Or_Empty_Parameter_Parameter()
            {
                //Given
                HttpSettings settings = new HttpSettings();
                string       schema   = "Bearer";

                //When
                var nullRecord  = Record.Exception(() => HttpSettingsExtensions.SetAuthorization(settings, schema, null));
                var emptyRecord = Record.Exception(() => HttpSettingsExtensions.SetAuthorization(settings, schema, ""));
                var spaceRecord = Record.Exception(() => HttpSettingsExtensions.SetAuthorization(settings, schema, "   "));

                //Then
                CakeAssert.IsArgumentNullException(nullRecord, "parameter");
                CakeAssert.IsArgumentNullException(emptyRecord, "parameter");
                CakeAssert.IsArgumentNullException(spaceRecord, "parameter");
            }
示例#19
0
            public void Should_Throw_On_Null_Or_Empty_Name_Parameter()
            {
                //Given
                HttpSettings settings = new HttpSettings();
                string       value    = "applicaion/json";

                //When
                var nullRecord  = Record.Exception(() => HttpSettingsExtensions.AppendHeader(settings, null, value));
                var emptyRecord = Record.Exception(() => HttpSettingsExtensions.AppendHeader(settings, "", value));
                var spaceRecord = Record.Exception(() => HttpSettingsExtensions.AppendHeader(settings, "   ", value));

                //Then
                CakeAssert.IsArgumentNullException(nullRecord, "name");
                CakeAssert.IsArgumentNullException(emptyRecord, "name");
                CakeAssert.IsArgumentNullException(spaceRecord, "name");
            }
示例#20
0
            public void Should_Throw_On_Null_Or_Empty_Schema_Parameter()
            {
                //Given
                HttpSettings settings  = new HttpSettings();
                string       parameter = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0b3B0YWwuY29tIiwiZXhwIjoxNDI2NDIwODAwLCJodHRwOi8vdG9wdGFsLmNvbS9qd3RfY2xhaW1zL2lzX2FkbWluIjp0cnVlLCJjb21wYW55IjoiVG9wdGFsIiwiYXdlc29tZSI6dHJ1ZX0.yRQYnWzskCZUxPwaQupWkiUzKELZ49eM7oWxAQK_ZXw";

                //When
                var nullRecord  = Record.Exception(() => HttpSettingsExtensions.SetAuthorization(settings, null, parameter));
                var emptyRecord = Record.Exception(() => HttpSettingsExtensions.SetAuthorization(settings, "", parameter));
                var spaceRecord = Record.Exception(() => HttpSettingsExtensions.SetAuthorization(settings, "   ", parameter));

                //Then
                CakeAssert.IsArgumentNullException(nullRecord, "schema");
                CakeAssert.IsArgumentNullException(emptyRecord, "schema");
                CakeAssert.IsArgumentNullException(spaceRecord, "schema");
            }
示例#21
0
            public void Should_Throw_On_Null_Or_Empty_Value_Parameter()
            {
                //Given
                HttpSettings settings = new HttpSettings();
                string       name     = "Content-Type";

                //When
                var nullRecord  = Record.Exception(() => HttpSettingsExtensions.AppendHeader(settings, name, null));
                var emptyRecord = Record.Exception(() => HttpSettingsExtensions.AppendHeader(settings, name, ""));
                var spaceRecord = Record.Exception(() => HttpSettingsExtensions.AppendHeader(settings, name, "   "));

                //Then
                CakeAssert.IsArgumentNullException(nullRecord, "value");
                CakeAssert.IsArgumentNullException(emptyRecord, "value");
                CakeAssert.IsArgumentNullException(spaceRecord, "value");
            }
示例#22
0
            public void Should_Throw_On_Null_FolderPath_Parameter()
            {
                //Given
                ICakeContext context = _Context;
                Action <SsrsConnectionSettings> settingsConfigurator = s => { };
                FilePath filePath   = "./App_Data/Reports/Employee_Sales_Summary.rdl";
                string   folderPath = null;
                IDictionary <string, string> properties = new Dictionary <string, string>()
                {
                    ["Description"] = "Great Description for a report"
                };

                //When
                var record = Record.Exception(() => SsrsAliases.SsrsUploadReport(context, filePath, folderPath, properties, settingsConfigurator));

                //Then
                CakeAssert.IsArgumentNullException(record, nameof(folderPath));
            }
示例#23
0
            public void Should_Throw_On_Null_Pattern_Parameter()
            {
                //Given
                ICakeContext context    = _Context;
                string       pattern    = null;
                string       folderPath = ParentFolderPath;
                IDictionary <string, string> properties = new Dictionary <string, string>()
                {
                    ["Description"] = "Great Description for a report"
                };
                SsrsConnectionSettings settings = _Settings;

                //When
                var record = Record.Exception(() => SsrsAliases.SsrsUploadReport(context, pattern, folderPath, properties, settings));

                //Then
                CakeAssert.IsArgumentNullException(record, nameof(pattern));
            }
示例#24
0
            public void Should_Throw_On_Null_Or_Empty_Folder_Parameter()
            {
                //Given
                ICakeContext           context  = _Context;
                SsrsConnectionSettings settings = _Settings;
                FindItemRequest        request  = new FindItemRequest
                {
                    Folder    = null,
                    ItemName  = "Item Name",
                    Recursive = true
                };

                //When
                var record = Record.Exception(() => SsrsAliases.SsrsFindItem(context, request, settings));

                //Then
                CakeAssert.IsArgumentNullException(record, nameof(request.Folder));
            }
示例#25
0
            public void Should_Throw_On_Null_SettingsConfigurator_Parameter()
            {
                //Given
                ICakeContext context = _Context;
                Action <SsrsConnectionSettings> settingsConfigurator = null;
                FindItemRequest request = new FindItemRequest
                {
                    Folder    = "/AdventureWorks",
                    ItemName  = null,
                    Recursive = true
                };

                //When
                var record = Record.Exception(() => SsrsAliases.SsrsFindItem(context, request, settingsConfigurator));

                //Then
                CakeAssert.IsArgumentNullException(record, nameof(settingsConfigurator));
            }
示例#26
0
            public void Should_Throw_On_Null_Settings_Context()
            {
                //Given
                ICakeContext           context  = null;
                SsrsConnectionSettings settings = _Settings;
                FilePath filePath   = "./App_Data/DataSources/AdventureWorks.rds";
                string   folderPath = ParentFolderPath;
                IDictionary <string, string> properties = new Dictionary <string, string>()
                {
                    ["Description"] = "Great Description for a DataSource"
                };

                //When
                var record = Record.Exception(() => SsrsAliases.SsrsUploadDataSource(context, filePath, folderPath, properties, settings));

                //Then
                CakeAssert.IsArgumentNullException(record, nameof(context));
            }
示例#27
0
            public void Should_Throw_On_Null_FilePath_Parameter()
            {
                //Given
                ICakeContext context = _Context;
                Action <SsrsConnectionSettings> settingsConfigurator = s => { };
                FilePath filePath   = null;
                string   folderPath = ParentFolderPath;
                IDictionary <string, string> properties = new Dictionary <string, string>()
                {
                    ["Description"] = "Great Description for a DataSource"
                };

                //When
                var record = Record.Exception(() => SsrsAliases.SsrsUploadDataSet(context, filePath, folderPath, properties, settingsConfigurator));

                //Then
                CakeAssert.IsArgumentNullException(record, nameof(filePath));
            }
示例#28
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));
            }
示例#29
0
            public void Should_Throw_On_Null_Or_Empty_Accept_Parameter()
            {
                //Given
                HttpSettings settings = new HttpSettings();
                string       accept   = null;

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

                accept = string.Empty;
                var emptyRecord = Record.Exception(() => HttpSettingsExtensions.SetAccept(settings, accept));

                accept = "      ";
                var spaceRecord = Record.Exception(() => HttpSettingsExtensions.SetAccept(settings, accept));

                //Then
                CakeAssert.IsArgumentNullException(nullRecord, nameof(accept));
                CakeAssert.IsArgumentNullException(emptyRecord, nameof(accept));
                CakeAssert.IsArgumentNullException(spaceRecord, nameof(accept));
            }
示例#30
0
            public void Should_Throw_On_Null_Or_Empty_Url_Parameter()
            {
                //Given
                HttpSettings settings = new HttpSettings();
                string       url      = null;

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

                url = string.Empty;
                var emptyRecord = Record.Exception(() => HttpSettingsExtensions.SetReferer(settings, url));

                url = "      ";
                var spaceRecord = Record.Exception(() => HttpSettingsExtensions.SetReferer(settings, url));

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