1 // ----------------------------------------------------------------------- 2 // Copyright (c) Microsoft Corporation. All rights reserved. 3 // ----------------------------------------------------------------------- 4 using System; 5 using System.Collections.Generic; 6 using System.ComponentModel.Composition; 7 using System.ComponentModel.Composition.Primitives; 8 using System.Linq; 9 10 namespace System.Diagnostics.Contracts 11 { 12 #if CONTRACTS_FULL 13 [ContractClassFor(typeof(ComposablePart))] 14 internal abstract class ComposablePartContract : ComposablePart 15 { 16 public override IEnumerable<ExportDefinition> ExportDefinitions 17 { 18 get 19 { 20 Contract.Ensures(Contract.Result<IEnumerable<ExportDefinition>>() != null); 21 22 throw new NotImplementedException(); 23 } 24 } 25 26 public override IEnumerable<ImportDefinition> ImportDefinitions 27 { 28 get 29 { 30 Contract.Ensures(Contract.Result<IEnumerable<ImportDefinition>>() != null); 31 32 throw new NotImplementedException(); 33 } 34 } 35 GetExportedValue(ExportDefinition definition)36 public override object GetExportedValue(ExportDefinition definition) 37 { 38 Contract.Requires(definition != null); 39 40 throw new NotImplementedException(); 41 } 42 SetImport(ImportDefinition definition, IEnumerable<Export> exports)43 public override void SetImport(ImportDefinition definition, IEnumerable<Export> exports) 44 { 45 Contract.Requires(definition != null); 46 Contract.Requires(exports != null); 47 48 throw new NotImplementedException(); 49 } 50 } 51 52 [ContractClassFor(typeof(ComposablePartDefinition))] 53 internal abstract class ComposablePartDefinitionContract : ComposablePartDefinition 54 { 55 public override IEnumerable<ExportDefinition> ExportDefinitions 56 { 57 get 58 { 59 Contract.Ensures(Contract.Result<IEnumerable<ExportDefinition>>() != null); 60 Contract.Ensures(Contract.ForAll(Contract.Result<IEnumerable<ExportDefinition>>(), e => e != null)); 61 62 throw new NotImplementedException(); 63 } 64 } 65 66 public override IEnumerable<ImportDefinition> ImportDefinitions 67 { 68 get 69 { 70 Contract.Ensures(Contract.Result<IEnumerable<ImportDefinition>>() != null); 71 Contract.Ensures(Contract.ForAll(Contract.Result<IEnumerable<ImportDefinition>>(), i => i != null)); 72 73 throw new NotImplementedException(); 74 } 75 } 76 CreatePart()77 public override ComposablePart CreatePart() 78 { 79 Contract.Ensures(Contract.Result<ComposablePart>() != null); 80 throw new NotImplementedException(); 81 } 82 } 83 84 [ContractClassFor(typeof(ICompositionElement))] 85 internal abstract class ICompositionElementContract : ICompositionElement 86 { 87 public string DisplayName 88 { 89 get 90 { 91 Contract.Ensures(!string.IsNullOrEmpty(Contract.Result<string>())); 92 93 throw new NotImplementedException(); 94 } 95 } 96 97 public ICompositionElement Origin 98 { 99 get { throw new NotImplementedException(); } 100 } 101 } 102 103 [ContractClassFor(typeof(ICompositionService))] 104 internal abstract class ICompositionServiceContract : ICompositionService 105 { SatisfyImportsOnce(ComposablePart part)106 public void SatisfyImportsOnce(ComposablePart part) 107 { 108 Contract.Requires(part != null); 109 throw new NotImplementedException(); 110 } 111 } 112 #endif 113 }