예제 #1
0
        public async void CanImportMetaDataAsync_Metadata_ShouldReturn_string_record_id()
        {
            // Arrange
            // This will wipe out the current data dictionary and update with the below meta.
            var metata = new List <RedcapMetaData> {
                new RedcapMetaData {
                    field_name     = "record_id",
                    form_name      = "demographics",
                    field_label    = "Study Id",
                    field_type     = "text",
                    section_header = "",
                },
                new RedcapMetaData {
                    field_name     = "first_name",
                    form_name      = "demographics",
                    field_label    = "First Name",
                    field_type     = "text",
                    section_header = "Contact Information",
                    identifier     = "y"
                },
                new RedcapMetaData {
                    field_name  = "last_name",
                    form_name   = "demographics",
                    field_label = "Last Name",
                    field_type  = "text",
                    identifier  = "y"
                },
                new RedcapMetaData {
                    field_name  = "address",
                    form_name   = "demographics",
                    field_label = "Street, City, State, ZIP",
                    field_type  = "notes",
                    identifier  = "y"
                },
                new RedcapMetaData {
                    field_name  = "email",
                    form_name   = "demographics",
                    field_label = "E-mail",
                    field_type  = "text",
                    identifier  = "y",
                    text_validation_type_or_show_slider_number = "email"
                },
                new RedcapMetaData {
                    field_name  = "dob",
                    form_name   = "demographics",
                    field_label = "Date of Birth",
                    field_type  = "text",
                    identifier  = "y",
                    text_validation_type_or_show_slider_number = "date_ymd"
                },
                new RedcapMetaData {
                    field_name  = "file_upload",
                    form_name   = "demographics",
                    field_label = "File Upload",
                    field_type  = "file"
                }
            };
            // Act
            var result = await _redcapApi.ImportMetaDataAsync(_token, Content.MetaData, ReturnFormat.json, metata);

            // Assert
            // Expecting 7 metada objects imported
            Assert.Contains("7", result);
        }