コード例 #1
0
        public void SettingTheSameErrorsDoesNotRaisePropertyChangedEvents()
        {
            _formStore.Handle(
                new UpdateFormAction(
                    "test-form",
                    FormUpdate.FieldErrors("test-field", _field.Errors)
                    )
                );

            AssertCollections(
                _storePropertyChanges,
                new[]
            {
                nameof(IFormStore.Forms)
            }
                );
            AssertCollections(
                _formPropertyChanges,
                new[]
            {
                nameof(IFormData.Fields)
            }
                );
            Assert.False(_fieldPropertyChanges.Any());
        }
コード例 #2
0
        public void SettingNullErrorsSetsEmptyCollection()
        {
            _formStore.Handle(
                new UpdateFormAction(
                    "test-form",
                    FormUpdate.FieldErrors("test-field", new[] { "error" }),
                    FormUpdate.FieldErrors("test-field", null)
                    )
                );

            Assert.False(_form["test-field"].Errors.Any());
            AssertCollections(
                _storePropertyChanges,
                new[]
            {
                nameof(IFormStore.Forms),
                "Items['test-form']['test-field'].Errors",
                "Items['test-form']['test-field'].Errors"
            }
                );
            AssertCollections(
                _formPropertyChanges,
                new[]
            {
                nameof(IFormData.Fields),
                "Items['test-field'].Errors",
                "Items['test-field'].Errors"
            }
                );
            AssertCollections(
                _fieldPropertyChanges,
                new[]
            {
                nameof(IFormFieldData.Errors),
                nameof(IFormFieldData.Errors)
            }
                );
        }
コード例 #3
0
        public void UpdatingAFormFieldErrorSetsItsErrors()
        {
            var errors = new[] { "error 1", "error 2" };

            _formStore.Handle(
                new UpdateFormAction(
                    "test-form",
                    FormUpdate.FieldErrors("test-field", errors)
                    )
                );

            Assert.Same(errors, _form["test-field"].Errors);
            AssertCollections(
                _storePropertyChanges,
                new[]
            {
                nameof(IFormStore.Forms),
                "Items['test-form']['test-field'].Errors"
            }
                );
            AssertCollections(
                _formPropertyChanges,
                new[]
            {
                nameof(IFormData.Fields),
                "Items['test-field'].Errors"
            }
                );
            AssertCollections(
                _fieldPropertyChanges,
                new[]
            {
                nameof(IFormFieldData.Errors)
            }
                );
        }