コード例 #1
0
        SearchSchema_when_schema_is_not_online_returns_stream_with_the_data_is_not_available()
        {
            //arrange
            var dsObj2 = new DataSetSchema()
            {
                Title = "schemaurl-disabled-true", IsDisabled = true, IsApproved = true, Category = new Category()
                {
                    IsDisabled = false
                }
            };

            _repositoryDataSetSchema.Add(dsObj2);
            var mut = new DataShareService();

            //act
            var stream = mut.SearchSchemaTextContains("", "schemaurl-disabled-true", "xml", "searchField", "searchtext");
            var sr     = new StreamReader(stream);
            var myStr  = sr.ReadToEnd();
            var result = myStr.Contains("This data is not available");

            //assert
            Assert.IsTrue(result);
            //cleanup
            _repositoryDataSetSchema.Delete(dsObj2);
        }
コード例 #2
0
        SearchSchema_when_result_count_is_0_returns_stream_with_the_no_matching_records_found()
        {
            //arrange
            var dsObj2 = new DataSetSchema()
            {
                Title = "schemaurl", IsDisabled = false, IsApproved = true, Category = new Category()
                {
                    IsDisabled = false
                }
            };

            _repositoryDataSetSchema.Add(dsObj2);
            var mut = new DataShareService();

            //act
            var stream = mut.SearchSchemaTextContains("", "schemaurl", "xml", "searchField", "searchtext");
            var sr     = new StreamReader(stream);
            var myStr  = sr.ReadToEnd();
            var result = myStr.Contains("No matching records found");

            //assert
            Assert.IsTrue(result);
            //cleanup
            _repositoryDataSetSchema.Delete(dsObj2);
        }
コード例 #3
0
        public void Api_GetCategory_Returns_List()
        {
            var service = new DataShareService();
            var result  = service.GetCategory();

            // Assert
            Assert.IsNotNull(result, "Should have returned IList<RestCategory> ");
            Assert.IsNotNull(result.Count() > 0, "Should have returned IList<RestCategory> ");
        }
コード例 #4
0
        GetSchemaDefinitionV2_when_Schema_definitioncolumn_linkeduri_is_null_sets_Uri_to_empty_string
            ()
        {
            //arrange
            var mut = new DataShareService();
            //act
            var result = mut.GetSchemaDefinitionV2("categoryurl", "schemaurl_return_dsObj4");

            //Assert
            Assert.AreEqual("", result.RestColumnDefinitions.ColumnDefinitions[3].Uri);
        }
コード例 #5
0
        GetSchemaDefinitionV2_when_Schema_definitioncolumn_is_not_null_and_maxNumber_is_number_type_and_maxNumber_is_null_returns_col_na_in_restcolumndefinition
            ()
        {
            //arrange
            var mut = new DataShareService();
            //act
            var result = mut.GetSchemaDefinitionV2("categoryurl", "schemaurl_return_dsObj4");

            //Assert
            Assert.AreEqual("N/A", result.RestColumnDefinitions.ColumnDefinitions[3].MaxNumber);
        }
コード例 #6
0
        GetSchemaDefinitionV2_when_Schema_definitioncolumn_is_not_null_and_maxCurrency_is_currency_type_and_maxCurrency_is_not_null_returns_col_maxCurrency_to_string_in_restcolumndefinition
            ()
        {
            //arrange
            var mut = new DataShareService();
            //act
            var result = mut.GetSchemaDefinitionV2("categoryurl", "schemaurl_return_dsObj3");

            //Assert
            Assert.AreEqual("100", result.RestColumnDefinitions.ColumnDefinitions[2].MaxCurrency);
        }
コード例 #7
0
        GetSchemaDefinitionV2_when_Schema_definitioncolumn_is_not_null_and_maxDate_is_datetime_type_and_maxdate_is_not_null_returns_col_maxdate_to_string_in_restcolumndefinition
            ()
        {
            //arrange
            var mut = new DataShareService();
            //act
            var result = mut.GetSchemaDefinitionV2("categoryurl", "schemaurl_return_dsObj3");

            //Assert
            Assert.AreEqual(new DateTime(2200, 1, 2).ToString(), result.RestColumnDefinitions.ColumnDefinitions[1].MaxDate);
        }
コード例 #8
0
        public void GetSchemaDefinitionv2_when_schema_is_null_returns_Schema_rest_definition_Error_message_this_schema_does_not_exist()
        {
            //arrange
            var mut = new DataShareService();
            //act
            var result = mut.GetSchemaDefinitionV2("categoryurl", "schemaurl");

            //assert
            Assert.AreEqual("This schema does not exist!", result.ErrorMessage);
            //cleanup
        }
コード例 #9
0
        public void Api_GetSchemas_Returns_List()
        {
            var firstCategory = _categoryService.GetAll(false)[0];

            var service = new DataShareService();
            var result  = service.GetSchemas(firstCategory.FriendlyUrl);

            // Assert
            Assert.IsNotNull(result, "Should have returned IList<RestCategory> ");
            Assert.IsNotNull(result.Count() > 0, "Should have returned IList<RestSchema> ");
        }
コード例 #10
0
        GetSchemaDefinitionV2_when_Schema_definitioncolumn_is_not_null_and_maxsize_less_than_zero_returns_col_n_a_in_restcolumndefinition
            ()
        {
            //arrange
            var mut = new DataShareService();
            //act
            var result = mut.GetSchemaDefinitionV2("categoryurl", "schemaurl_return_dsObj4");

            //Assert
            Assert.AreEqual("N/A", result.RestColumnDefinitions.ColumnDefinitions[0].MaxSize);
        }
コード例 #11
0
        public void GetSchemaDefinitionv2_when_schema_is_not_disabled_and_isOnline_and_Schema_DataSetSchemaDefinition_is_null_returns_schemarestdefinitionobject_type()
        {
            //arrange

            var mut = new DataShareService();
            //act
            var result = mut.GetSchemaDefinitionV2("categoryurl", "schemaurl_disabled_false_online_true");

            //assert
            Assert.AreEqual(typeof(SchemaRestDefinition), result.GetType());
            //cleanup
        }
コード例 #12
0
        public void GetSchemaDefinitionv2_when_schema_is_disabled_returns_Schema_rest_definition_with_esdlinks_as_null()
        {
            //arrange

            var mut = new DataShareService();
            //act
            var result = mut.GetSchemaDefinitionV2("categoryurl", "schemaurl_disabled_true");

            //assert
            Assert.IsNull(result.EsdLinks);
            //cleanup
        }
コード例 #13
0
        public void GetSchemaDefinitionv2_when_schema_is_disabled_returns_Schema_rest_definition_Error_message_this_schema_has_been_disabled()
        {
            //arrange

            var mut = new DataShareService();
            //act
            var result = mut.GetSchemaDefinitionV2("categoryurl", "schemaurl_disabled_true");

            //assert
            Assert.AreEqual("This schema has been disabled", result.ErrorMessage);
            //cleanup
        }
コード例 #14
0
        SearchSchema_when_schema_is_null_returns_stream_with_the_data_is_not_available()
        {
            //arrange
            var mut = new DataShareService();
            //act
            var stream = mut.SearchSchemaTextContains("", "schemaurl", "xml", "searchField", "searchtext");
            var sr     = new StreamReader(stream);
            var myStr  = sr.ReadToEnd();
            var result = myStr.Contains("This data is not available");

            //assert
            Assert.IsTrue(result);
        }
コード例 #15
0
        SearchSchemaDate_when_to_is_not_valid_format_dd_mm_yyyy_date_returns_stream_with_invalid_date_format()
        {
            //arrange
            var mut = new DataShareService();

            //act
            var stream = mut.SearchSchemaDate("", "schemaurl", "xml", "searchField", "12-12-1220", "1212-1220");

            var sr    = new StreamReader(stream);
            var myStr = sr.ReadToEnd();

            var result = myStr.Contains("Invalid Date Format");

            //assert
            Assert.IsTrue(result);
        }
コード例 #16
0
ファイル: SwarmConnect.cs プロジェクト: sora-jp/leak
        private void StartDataShare()
        {
            DataShareHooks hooks = new DataShareHooks
            {
            };

            DataShare =
                new DataShareBuilder()
                .WithHash(Hash)
                .WithPipeline(Pipeline)
                .WithGlue(Coordinator.AsDataShare())
                .WithDataStore(DataStore.AsDataShare())
                .WithDataMap(DataMap.AsDataShare())
                .Build(hooks);

            DataShare.Start();
        }
コード例 #17
0
        public void Api_SearchSchemaNumberEquals_Returns_Numbers_EqualTo_SearchTextl()
        {
            var firstCategory = _categoryService.GetAll(false)[0];

            var service = new DataShareService();
            var result  = service.SearchSchemaNumberEquals(firstCategory.FriendlyUrl, firstCategory.Schemas[0].FriendlyUrl, "xml", "Amount", "1000");

            using (var reader = new StreamReader(result))
            {
                var xml = XElement.Parse(reader.ReadToEnd());

                var shouldHaveData = xml.Descendants("Amount").Where(p => p.Value == "1000").ToList();
                var shouldBeEmpty  = xml.Descendants("Amount").Where(p => p.Value != "1000").ToList();

                Assert.IsTrue(shouldHaveData.Count() > 0, "Should have returned records matching searchtext ");
                Assert.IsTrue(shouldBeEmpty.Count() == 0, "Should return nothing for records that do nothave searchtext  ");
            }
        }
コード例 #18
0
        public void Api_SearchSchemaTextEquals_Returns_Data_EqualTo_SearchTextl()
        {
            var firstCategory = _categoryService.GetAll(false)[0];

            var service = new DataShareService();
            var result  = service.SearchSchemaTextEquals(firstCategory.FriendlyUrl, firstCategory.Schemas[0].FriendlyUrl, "xml", "Service", "Children's Services - Commissioning & Social Work");

            using (var reader = new StreamReader(result))
            {
                var xml = XElement.Parse(reader.ReadToEnd());

                var shouldHaveData = xml.Descendants("Service").Where(p => p.Value.Contains("Children's Services - Commissioning & Social Work")).ToList();
                var shouldBeEmpty  = xml.Descendants("Service").Where(p => !p.Value.Contains("Children's Services - Commissioning & Social Work")).ToList();

                Assert.IsTrue(shouldHaveData.Count() > 0, "Should have returned records equal to Children's Services - Commissioning & Social Work ");
                Assert.IsTrue(shouldBeEmpty.Count() == 0, "Should return nothing");
            }
        }
コード例 #19
0
        public void Api_SearchSchemaNumberLessThanEqualTo_Returns_Numbers_Less_Than_Or_Equal_To_SearchText()
        {
            var firstCategory = _categoryService.GetAll(false)[0];

            var service = new DataShareService();
            var result  = service.SearchSchemaNumberLessThanEqualTo(firstCategory.FriendlyUrl, firstCategory.Schemas[0].FriendlyUrl, "xml", "Amount", "1000");

            using (var reader = new StreamReader(result))
            {
                var xml = XElement.Parse(reader.ReadToEnd());

                var shouldHaveData = xml.Descendants("Amount").Where(p => Convert.ToInt32(p.Value) <= 1000).ToList();
                var shouldBeEmpty  = xml.Descendants("Amount").Where(p => Convert.ToInt32(p.Value) > 1000).ToList();

                Assert.IsTrue(shouldHaveData.Count() > 0, "Should have returned amounts less than or equal to 1000");
                Assert.IsTrue(shouldBeEmpty.Count() == 0, "Should return nothing");
            }
        }
コード例 #20
0
ファイル: DatashareSession.cs プロジェクト: vnvizitiu/leak
 public DataShareSession(DataShareService service)
 {
     this.service = service;
 }