Exemplo n.º 1
0
        public void ConfigurationFileShouldSupercedeApiForReplace()
        {
            var testSubject = new DataServiceBehavior {
                AcceptReplaceFunctionInQuery = false
            };
            DataServicesReplaceFunctionFeature replaceFeature = new TestReplaceFeature(true)
            {
                Enable = true
            };
            DataServicesFeaturesSection dataServicesFeaturesSection = new DataServicesFeaturesSection {
                ReplaceFunction = replaceFeature
            };

            testSubject.ApplySettingsFromConfiguration(dataServicesFeaturesSection);
            testSubject.AcceptReplaceFunctionInQuery.Should().BeTrue();

            replaceFeature.Enable = false;
            testSubject.ApplySettingsFromConfiguration(dataServicesFeaturesSection);
            testSubject.AcceptReplaceFunctionInQuery.Should().BeFalse();
        }
Exemplo n.º 2
0
        public void ConfigurationFileShouldForReplaceShouldOnlyBeAppliedIfPresent()
        {
            var testSubject = new DataServiceBehavior {
                AcceptReplaceFunctionInQuery = true
            };

            testSubject.ApplySettingsFromConfiguration(new DataServicesFeaturesSection {
                ReplaceFunction = new TestReplaceFeature(false)
                {
                    Enable = false
                }
            });
            testSubject.AcceptReplaceFunctionInQuery.Should().BeTrue();
        }