Example #1
0
        public void SettingTheSameProcessingStateDoesNotRaisePropertyChangedEvents()
        {
            _formStore.Handle(
                new UpdateFormAction(
                    "test-form",
                    FormUpdate.FieldProcessingState("test-field", _field.ProcessingState)
                    )
                );

            AssertCollections(
                _storePropertyChanges,
                new[]
            {
                nameof(IFormStore.Forms)
            }
                );
            AssertCollections(
                _formPropertyChanges,
                new[]
            {
                nameof(IFormData.Fields)
            }
                );
            Assert.False(_fieldPropertyChanges.Any());
        }
Example #2
0
        public void SettingTheProcessingStateOfAFieldToNullResetsTheRelatedFlag()
        {
            var value = new object();

            _formStore.Handle(
                new UpdateFormAction(
                    "test-form",
                    FormUpdate.FieldProcessingState("test-field", "loading"),
                    FormUpdate.FieldProcessingState("test-field", null)
                    )
                );

            Assert.Null(_form["test-field"].ProcessingState);
            Assert.False(_form["test-field"].IsProcessing);
            AssertCollections(
                _storePropertyChanges,
                new[]
            {
                nameof(IFormStore.Forms),
                "Items['test-form']['test-field'].ProcessingState",
                "Items['test-form']['test-field'].IsProcessing",
                "Items['test-form']['test-field'].ProcessingState",
                "Items['test-form']['test-field'].IsProcessing"
            }
                );
            AssertCollections(
                _formPropertyChanges,
                new[]
            {
                nameof(IFormData.Fields),
                "Items['test-field'].ProcessingState",
                "Items['test-field'].IsProcessing",
                "Items['test-field'].ProcessingState",
                "Items['test-field'].IsProcessing"
            }
                );
            AssertCollections(
                _fieldPropertyChanges,
                new[]
            {
                nameof(IFormFieldData.ProcessingState),
                nameof(IFormFieldData.IsProcessing),
                nameof(IFormFieldData.ProcessingState),
                nameof(IFormFieldData.IsProcessing)
            }
                );
        }
Example #3
0
        public void ChangingAFormFieldProcessingStateDoesNotChangeRelatedFlag()
        {
            var value = new object();

            _formStore.Handle(
                new UpdateFormAction(
                    "test-form",
                    FormUpdate.FieldProcessingState("test-field", "loading"),
                    FormUpdate.FieldProcessingState("test-field", "processing")
                    )
                );

            Assert.Equal("processing", _form["test-field"].ProcessingState);
            Assert.True(_form["test-field"].IsProcessing);
            AssertCollections(
                _storePropertyChanges,
                new[]
            {
                nameof(IFormStore.Forms),
                "Items['test-form']['test-field'].ProcessingState",
                "Items['test-form']['test-field'].IsProcessing",
                "Items['test-form']['test-field'].ProcessingState"
            }
                );
            AssertCollections(
                _formPropertyChanges,
                new[]
            {
                nameof(IFormData.Fields),
                "Items['test-field'].ProcessingState",
                "Items['test-field'].IsProcessing",
                "Items['test-field'].ProcessingState"
            }
                );
            AssertCollections(
                _fieldPropertyChanges,
                new[]
            {
                nameof(IFormFieldData.ProcessingState),
                nameof(IFormFieldData.IsProcessing),
                nameof(IFormFieldData.ProcessingState)
            }
                );
        }