示例#1
0
        public void Return_Empty_Dictionary_With_Required_Field_With_Invalid_Case()
        {
            var shape = (DataShapingExtensions.ShapeDataList(_samples, nameof(Sample.Name).ToUpperInvariant())
                         .Single().Value as IEnumerable <IDictionary <string, object> >).ToList();

            shape.ShouldBeEmpty();
        }
示例#2
0
        public void Return_Dictionary_For_All_Fields_If_Fields_Empty()
        {
            var shape = DataShapingExtensions.ShapeData(_sample, string.Empty);

            shape.ShouldNotBeEmpty();
            shape.Count.ShouldBe(3);
        }
示例#3
0
        public void Return_Empty_Dictionary_With_Required_Non_Existing_Field()
        {
            var shape = (DataShapingExtensions.ShapeDataList(_samples, $"NonExistingProperty")
                         .Single().Value as IEnumerable <IDictionary <string, object> >).ToList();

            shape.ShouldBeEmpty();
        }
示例#4
0
        public void Return_Dictionary_For_Required_Fields()
        {
            var shape = DataShapingExtensions.ShapeData(_sample, $"{nameof(_sample.Id)},{nameof(_sample.BirthDate)}");

            shape.ShouldNotBeEmpty();
            shape.Count.ShouldBe(2);
            shape.Keys.ShouldContain(nameof(_sample.Id));
            shape.Keys.ShouldContain(nameof(_sample.BirthDate));
        }
示例#5
0
        public void Return_Dictionary_For_Required_Field()
        {
            var shape = DataShapingExtensions.ShapeData(_sample, nameof(_sample.BirthDate));

            shape.ShouldNotBeEmpty();
            shape.Count.ShouldBe(1);
            shape.Single().Key.ShouldBe(nameof(_sample.BirthDate));
            shape.Single().Value.ShouldBe(_sample.BirthDate);
        }
示例#6
0
        public void Return_List_Of_Dictionary_With_Required_Fields()
        {
            var shape = (DataShapingExtensions.ShapeDataList(_samples, $"{nameof(Sample.Name)},{nameof(Sample.BirthDate)}")
                         .Single().Value as IEnumerable <IDictionary <string, object> >).ToList();

            shape.ShouldNotBeEmpty();
            shape.First().Keys.Count.ShouldBe(2);
            shape.First().Keys.ShouldContain(nameof(Sample.Name));
            shape.First().Keys.ShouldContain(nameof(Sample.BirthDate));
        }
示例#7
0
        public void Return_List_Of_Dictionary_With_All_Fields_If_Fields_Empty()
        {
            var shape = DataShapingExtensions.ShapeDataList(_samples, string.Empty);

            shape.ShouldNotBeEmpty();
            shape.Count.ShouldBe(1);

            var shapedList = shape.Single().Value as IEnumerable <IDictionary <string, object> >;

            shapedList.ShouldNotBeEmpty();

            var list = shapedList.ToList();

            list.Count.ShouldBe(5);

            list.First().Values.Count.ShouldBe(3);
        }
示例#8
0
        public void Return_List_Of_Dictionary_With_Required_Field()
        {
            var shape = DataShapingExtensions.ShapeDataList(_samples, nameof(Sample.BirthDate));

            shape.ShouldNotBeEmpty();
            shape.Count.ShouldBe(1);

            var shapedList = shape.Single().Value as IEnumerable <IDictionary <string, object> >;

            shapedList.ShouldNotBeEmpty();

            var list = shapedList.ToList();

            list.Count.ShouldBe(5);

            list.First().Values.Count.ShouldBe(1);
            list.First().Keys.Single().ShouldBe(nameof(Sample.BirthDate));
        }
示例#9
0
        public void Return_No_Data_For_Required_Field_With_Invalid_Case()
        {
            var shape = DataShapingExtensions.ShapeData(_sample, nameof(_sample.Name).ToUpperInvariant());

            shape.ShouldBeEmpty();
        }
示例#10
0
        public void Return_No_Data_For_Required_Non_Existing_Field()
        {
            var shape = DataShapingExtensions.ShapeData(_sample, $"NonExistingProperty");

            shape.ShouldBeEmpty();
        }
示例#11
0
        public void Return_Empty_Result()
        {
            var shape = DataShapingExtensions.ShapeData <Sample>(null, null);

            shape.ShouldBeEmpty();
        }