Пример #1
0
        public void ShouldBeInvalidFormatFieldNameException()
        {
            var builder = new SettingsBuilder();

            builder
            .PageNumberFieldName("A+");

            builder.Invoking(b => b.Build())
            .Should()
            .Throw <InvalidFormatFieldNameException>();
        }
Пример #2
0
        public void ShouldBeAlreadyFieldNameUsedException()
        {
            var builder = new SettingsBuilder();

            builder
            .PageNumberFieldName("A")
            .PageSizeFieldName("A");

            builder.Invoking(b => b.Build())
            .Should()
            .Throw <AlreadyFieldNameUsedException>();
        }
Пример #3
0
        public void ShouldBeCustomValidBuilder()
        {
            var builder = new SettingsBuilder();

            builder
            .PageNumberFieldName("a")
            .PageSize(2)
            .PageSizeFieldName("b")
            .QueryFieldName("c")
            .SortFieldName("d");

            var expected = builder.Build();

            expected
            .PageNumberField.Should().Be("a");
            expected
            .PageSize.Should().Be(2);
            expected
            .PageSizeField.Should().Be("b");
            expected
            .QueryField.Should().Be("c");
            expected
            .SortField.Should().Be("d");
        }