public void ODataMessageReaderCopyConstructorTest() { ODataMessageReaderSettings settings = new ODataMessageReaderSettings(); var copyOfSettings = settings.Clone(); // Compare original and settings created from copy constructor without setting values this.CompareMessageReaderSettings(settings, copyOfSettings); // Compare original and settings created from copy constructor after setting some values settings.BaseUri = new Uri("http://www.odata.org"); settings.EnableCharactersCheck = true; copyOfSettings = settings.Clone(); this.CompareMessageReaderSettings(settings, copyOfSettings); // Compare original and settings created from copy constructor after setting rest of the values settings.EnableMessageStreamDisposal = false; settings.Validations &= ~ValidationKinds.ThrowOnUndeclaredPropertyForNonOpenType; settings.Version = ODataVersion.V401; settings.MaxProtocolVersion = ODataVersion.V401; settings.LibraryCompatibility = ODataLibraryCompatibility.Version6; settings.MessageQuotas.MaxPartsPerBatch = 100; settings.MessageQuotas.MaxOperationsPerChangeset = 200; settings.MessageQuotas.MaxNestingDepth = 20; settings.MessageQuotas.MaxReceivedMessageSize = 2000; copyOfSettings = settings.Clone(); this.CompareMessageReaderSettings(settings, copyOfSettings); // Compare original and settings created from copy constructor after setting some values to null and changing some other values settings.BaseUri = null; settings.EnableCharactersCheck = false; copyOfSettings = settings.Clone(); this.CompareMessageReaderSettings(settings, copyOfSettings); }
public void CopyConstructorShouldCopyAnnotationFilter() { ODataMessageReaderSettings testSubject = new ODataMessageReaderSettings(); testSubject.ShouldIncludeAnnotation = ODataUtils.CreateAnnotationFilter("namespace.*"); var copy = testSubject.Clone(); Assert.Same(testSubject.ShouldIncludeAnnotation, copy.ShouldIncludeAnnotation); }