Ejemplo n.º 1
0
        public async Task Should_not_add_error_if_json_is_valid()
        {
            var sut = new JsonField(1, "my-json", Partitioning.Invariant);

            await sut.ValidateAsync(CreateValue(new JValue(1)), false, errors);

            Assert.Empty(errors);
        }
Ejemplo n.º 2
0
        public async Task Should_not_add_error_if_json_is_valid()
        {
            var sut = new JsonField(1, "my-json", new JsonFieldProperties());

            await sut.ValidateAsync(CreateValue(new JValue(1)), errors);

            Assert.Empty(errors);
        }
Ejemplo n.º 3
0
        public async Task Should_add_errors_if_json_is_required()
        {
            var sut = new JsonField(1, "my-json", Partitioning.Invariant, new JsonFieldProperties {
                IsRequired = true
            });

            await sut.ValidateAsync(CreateValue(JValue.CreateNull()), false, errors);

            errors.ShouldBeEquivalentTo(
                new[] { "<FIELD> is required" });
        }
Ejemplo n.º 4
0
        public void Should_clone_object()
        {
            var sut = new JsonField(1, "my-json", Partitioning.Invariant);

            Assert.NotEqual(sut, sut.Enable());
        }
Ejemplo n.º 5
0
        public void Should_instantiate_field()
        {
            var sut = new JsonField(1, "my-json", Partitioning.Invariant);

            Assert.Equal("my-json", sut.Name);
        }
Ejemplo n.º 6
0
        public void Should_clone_object()
        {
            var sut = new JsonField(1, "my-json", new JsonFieldProperties());

            Assert.NotEqual(sut, sut.Enable());
        }
Ejemplo n.º 7
0
        public void Should_instantiate_field()
        {
            var sut = new JsonField(1, "my-json", new JsonFieldProperties());

            Assert.Equal("my-json", sut.Name);
        }