public async Task Should_not_add_error_if_number_is_valid() { var sut = new NumberField(1, "my-number", new NumberFieldProperties()); await sut.ValidateAsync(CreateValue(null), errors); Assert.Empty(errors); }
public async Task Should_not_add_error_if_number_is_valid() { var sut = new NumberField(1, "my-number", Partitioning.Invariant); await sut.ValidateAsync(CreateValue(null), false, errors); Assert.Empty(errors); }
private NumberField AddField() { var field = new NumberField(1, "my-field", new NumberFieldProperties()); sut = sut.AddOrUpdateField(field); return(field); }
private NumberField AddField() { var field = new NumberField(1, "my-field", Partitioning.Invariant); sut = sut.AddOrUpdateField(field); return(field); }
public async Task Should_add_errors_if_value_is_not_valid() { var sut = new NumberField(1, "my-number", Partitioning.Invariant); await sut.ValidateAsync(CreateValue("Invalid"), false, errors); errors.ShouldBeEquivalentTo( new[] { "<FIELD> is not a valid value" }); }
public async Task Should_add_errors_if_value_is_not_valid() { var sut = new NumberField(1, "my-number", new NumberFieldProperties()); await sut.ValidateAsync(CreateValue("Invalid"), errors); errors.ShouldBeEquivalentTo( new[] { "<FIELD> is not a valid value" }); }
public async Task Should_add_errors_if_number_is_not_allowed() { var sut = new NumberField(1, "my-number", Partitioning.Invariant, new NumberFieldProperties { AllowedValues = ImmutableList.Create(10d) }); await sut.ValidateAsync(CreateValue(20), false, errors); errors.ShouldBeEquivalentTo( new[] { "<FIELD> is not an allowed value" }); }
public async Task Should_add_errors_if_number_is_greater_than_max() { var sut = new NumberField(1, "my-number", Partitioning.Invariant, new NumberFieldProperties { MaxValue = 10 }); await sut.ValidateAsync(CreateValue(20), false, errors); errors.ShouldBeEquivalentTo( new[] { "<FIELD> must be less than '10'" }); }
public async Task Should_add_errors_if_number_is_required() { var sut = new NumberField(1, "my-number", Partitioning.Invariant, new NumberFieldProperties { IsRequired = true }); await sut.ValidateAsync(CreateValue(null), false, errors); errors.ShouldBeEquivalentTo( new[] { "<FIELD> is required" }); }
public async Task Should_add_errors_if_number_is_less_than_min() { var sut = new NumberField(1, "my-number", new NumberFieldProperties { MinValue = 10 }); await sut.ValidateAsync(CreateValue(5), errors); errors.ShouldBeEquivalentTo( new[] { "<FIELD> must be greater than '10'" }); }
public void Should_clone_object() { var sut = new NumberField(1, "my-number", Partitioning.Invariant); Assert.NotEqual(sut, sut.Enable()); }
public void Should_instantiate_field() { var sut = new NumberField(1, "my-number", Partitioning.Invariant); Assert.Equal("my-number", sut.Name); }
public void Should_clone_object() { var sut = new NumberField(1, "my-number", new NumberFieldProperties()); Assert.NotEqual(sut, sut.Enable()); }
public void Should_instantiate_field() { var sut = new NumberField(1, "my-number", new NumberFieldProperties()); Assert.Equal("my-number", sut.Name); }