Exemplo n.º 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();
        }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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));
        }
Exemplo n.º 6
0
        public void Return_Empty_Result()
        {
            var shape = DataShapingExtensions.ShapeDataList <Sample>(null, null);

            shape.ShouldBeEmpty();
        }