Changeset 425
- Timestamp:
- 02/08/10 09:34:39 (6 months ago)
- Location:
- branches/2.0.3000
- Files:
-
- 29 added
- 3 removed
- 76 modified
- 4 copied
- 1 moved
-
reports/nunit/.xml (modified) (1 diff)
-
src/core/OpenRasta.Net35/Web/Markup/ExpressionTreeXhtmlExtensions.cs (modified) (2 diffs)
-
src/core/OpenRasta.Tests.Integration/Binding/CustomSurrogates.cs (copied) (copied from branches/2.0.3000/src/core/OpenRasta.Tests.Integration/Security/DigestAuthentication_Specification.cs) (3 diffs)
-
src/core/OpenRasta.Tests.Integration/OpenRasta.Tests.Integration.csproj (modified) (2 diffs)
-
src/core/OpenRasta.Tests.Integration/Settings.StyleCop (added)
-
src/core/OpenRasta.Tests.Unit/Binding/DefaultBinderLocator_Specification.cs (modified) (1 diff)
-
src/core/OpenRasta.Tests.Unit/Binding/KeyedValuesBinder_Specification.cs (modified) (1 diff)
-
src/core/OpenRasta.Tests.Unit/Codecs/ApplicationXWwwUrlformEncodedCodec_Specification.cs (modified) (2 diffs)
-
src/core/OpenRasta.Tests.Unit/Codecs/CodecMatch_Specification.cs (modified) (1 diff)
-
src/core/OpenRasta.Tests.Unit/Codecs/CodecRepository_Specification.cs (modified) (3 diffs)
-
src/core/OpenRasta.Tests.Unit/Codecs/MultipartFormDataCodec_Specification.cs (modified) (1 diff)
-
src/core/OpenRasta.Tests.Unit/Codecs/media_type_reader_context.cs (modified) (1 diff)
-
src/core/OpenRasta.Tests.Unit/Configuration/LegacyManualConfiguration_Specification.cs (modified) (3 diffs)
-
src/core/OpenRasta.Tests.Unit/Configuration/MetaModelHandler_Specification.cs (modified) (5 diffs)
-
src/core/OpenRasta.Tests.Unit/Configuration/MetaModel_Specification.cs (modified) (2 diffs)
-
src/core/OpenRasta.Tests.Unit/Fakes/Customer.cs (modified) (1 diff)
-
src/core/OpenRasta.Tests.Unit/OpenRasta.Tests.Unit.csproj (modified) (1 diff)
-
src/core/OpenRasta.Tests.Unit/OperationModel/CodecSelectors/RequestCodecSelector_Specification.cs (modified) (4 diffs)
-
src/core/OpenRasta.Tests.Unit/TypeSystem/Instances_Specification.cs (modified) (22 diffs)
-
src/core/OpenRasta.Tests.Unit/TypeSystem/Members_Specification.cs (modified) (22 diffs)
-
src/core/OpenRasta.Tests.Unit/TypeSystem/PropertyPathManager_Specification.cs (modified) (1 diff)
-
src/core/OpenRasta.Tests.Unit/TypeSystem/Surrogate2_Specification.cs (added)
-
src/core/OpenRasta.Tests.Unit/TypeSystem/Surrogates_Specification.cs (modified) (9 diffs)
-
src/core/OpenRasta.Tests.Unit/Web/Handlers/HandlerRepository_Specification.cs (modified) (6 diffs)
-
src/core/OpenRasta.Tests.Unit/Web/Markup/SelectElement_Specification.cs (modified) (2 diffs)
-
src/core/OpenRasta.Tests.Unit/Web/Pipeline/Contributors/ResponseEntityWriter_Specification.cs (modified) (1 diff)
-
src/core/OpenRasta.Tests.Unit/Web/TemplatedUriResolver_Specification.cs (modified) (11 diffs)
-
src/core/OpenRasta.Tests.Unit/openrasta_context.cs (modified) (3 diffs)
-
src/core/OpenRasta/Binding/BinderAttribute.cs (added)
-
src/core/OpenRasta/Binding/BinderBaseAttribute.cs (modified) (1 diff)
-
src/core/OpenRasta/Binding/BindingResult.cs (modified) (3 diffs)
-
src/core/OpenRasta/Binding/ChangeSetBinder.cs (modified) (1 diff)
-
src/core/OpenRasta/Binding/DefaultObjectBinderLocator.cs (modified) (2 diffs)
-
src/core/OpenRasta/Binding/IObjectBinder.cs (modified) (1 diff)
-
src/core/OpenRasta/Binding/IObjectBinderLocator.cs (modified) (1 diff)
-
src/core/OpenRasta/Binding/KeyedValues.cs (modified) (1 diff)
-
src/core/OpenRasta/Binding/KeyedValuesBinder.cs (modified) (7 diffs)
-
src/core/OpenRasta/Binding/KeyedValuesBinderAttribute.cs (modified) (1 diff)
-
src/core/OpenRasta/Binding/KeyedValues`1.cs (modified) (2 diffs)
-
src/core/OpenRasta/Binding/ValueConverter.cs (modified) (1 diff)
-
src/core/OpenRasta/Codecs/CodecRepository.cs (modified) (3 diffs)
-
src/core/OpenRasta/Configuration/DefaultDependencyRegistrar.cs (modified) (8 diffs)
-
src/core/OpenRasta/Data/ChangeSet`1.cs (modified) (4 diffs)
-
src/core/OpenRasta/OpenRasta.csproj (modified) (6 diffs)
-
src/core/OpenRasta/OperationModel/CodecSelectors/RequestCodecSelector.cs (modified) (1 diff)
-
src/core/OpenRasta/OperationModel/MethodBased/TypeExclusionMethodFilter.cs (modified) (2 diffs)
-
src/core/OpenRasta/Security/RequiresAuthenticationAttribute.cs (modified) (6 diffs)
-
src/core/OpenRasta/TypeSystem/DebuggerStrings.cs (added)
-
src/core/OpenRasta/TypeSystem/IAttributeProvider.cs (modified) (1 diff)
-
src/core/OpenRasta/TypeSystem/IMember.cs (modified) (1 diff)
-
src/core/OpenRasta/TypeSystem/IMemberBuilder.cs (modified) (1 diff)
-
src/core/OpenRasta/TypeSystem/IMethod.cs (modified) (1 diff)
-
src/core/OpenRasta/TypeSystem/IPathManager.cs (modified) (2 diffs)
-
src/core/OpenRasta/TypeSystem/IProperty.cs (modified) (2 diffs)
-
src/core/OpenRasta/TypeSystem/IPropertyBuilder.cs (modified) (1 diff)
-
src/core/OpenRasta/TypeSystem/ISurrogateProvider.cs (moved) (moved from branches/2.0.3000/src/core/OpenRasta/TypeSystem/ISurrogateFactory.cs) (1 diff)
-
src/core/OpenRasta/TypeSystem/IType.cs (modified) (1 diff)
-
src/core/OpenRasta/TypeSystem/ITypeBuilder.cs (modified) (1 diff)
-
src/core/OpenRasta/TypeSystem/ITypeSystem.cs (modified) (1 diff)
-
src/core/OpenRasta/TypeSystem/MemberBuilder.cs (modified) (4 diffs)
-
src/core/OpenRasta/TypeSystem/MemberExtensions.cs (modified) (2 diffs)
-
src/core/OpenRasta/TypeSystem/ParameterInstance.cs (deleted)
-
src/core/OpenRasta/TypeSystem/PathComponent.cs (modified) (1 diff)
-
src/core/OpenRasta/TypeSystem/PathComponentType.cs (modified) (1 diff)
-
src/core/OpenRasta/TypeSystem/PathManager.cs (modified) (8 diffs)
-
src/core/OpenRasta/TypeSystem/PropertyBuilder.cs (modified) (4 diffs)
-
src/core/OpenRasta/TypeSystem/PropertyExtensions.cs (added)
-
src/core/OpenRasta/TypeSystem/ReflectionBased/ReflectionBasedMember.cs (modified) (9 diffs)
-
src/core/OpenRasta/TypeSystem/ReflectionBased/ReflectionBasedMethod.cs (modified) (2 diffs)
-
src/core/OpenRasta/TypeSystem/ReflectionBased/ReflectionBasedParameter.cs (modified) (2 diffs)
-
src/core/OpenRasta/TypeSystem/ReflectionBased/ReflectionBasedProperty.cs (modified) (5 diffs)
-
src/core/OpenRasta/TypeSystem/ReflectionBased/ReflectionBasedType.cs (modified) (6 diffs)
-
src/core/OpenRasta/TypeSystem/ReflectionBased/ReflectionBasedTypeSystem.cs (modified) (2 diffs)
-
src/core/OpenRasta/TypeSystem/ReflectionBased/ReflectionExtensions.cs (modified) (16 diffs)
-
src/core/OpenRasta/TypeSystem/ReflectionBased/Surrogates (deleted)
-
src/core/OpenRasta/TypeSystem/ReflectionBased/TypeSystems.cs (added)
-
src/core/OpenRasta/TypeSystem/ReflectionParameter.cs (deleted)
-
src/core/OpenRasta/TypeSystem/Surrogated (added)
-
src/core/OpenRasta/TypeSystem/Surrogated/AlienMember.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogated/AlienOwnedProperty.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogated/AlienPropertyBuilder.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogated/AlienType.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogated/IHasWrappedMember.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogated/IKeepSurrogateInstances.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogated/MemberWithSurrogates.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogated/PropertyWithSurrogates.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogated/PropertyWithSurrogatesBuilder.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogated/SurrogateBuilderProvider.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogated/TypeWithSurrogates.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogated/TypeWithSurrogatesBuilder.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogated/WrappedMember.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogated/WrappedProperty.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogates (added)
-
src/core/OpenRasta/TypeSystem/Surrogates/ISurrogate.cs (copied) (copied from branches/2.0.3000/src/core/OpenRasta/TypeSystem/ReflectionBased/Surrogates/ISurrogate.cs) (1 diff)
-
src/core/OpenRasta/TypeSystem/Surrogates/ISurrogateBuilder.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogates/Static (added)
-
src/core/OpenRasta/TypeSystem/Surrogates/Static/AbstractStaticSurrogate.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogates/Static/AbstractStaticSurrogateBuilder.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogates/Static/CollectionIndexerSurrogate.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogates/Static/CollectionSurrogateBuilder.cs (added)
-
src/core/OpenRasta/TypeSystem/Surrogates/Static/DateTimeSurrogate.cs (copied) (copied from branches/2.0.3000/src/core/OpenRasta/TypeSystem/ReflectionBased/Surrogates/DateTimeSurrogate.cs) (6 diffs)
-
src/core/OpenRasta/TypeSystem/Surrogates/Static/ListIndexerSurrogate.cs (copied) (copied from branches/2.0.3000/src/core/OpenRasta/TypeSystem/ReflectionBased/Surrogates/ListIndexerSurrogate.cs) (7 diffs)
-
src/core/OpenRasta/TypeSystem/Surrogates/Static/ListIndexerSurrogateBuilder.cs (added)
-
src/core/OpenRasta/TypeSystem/TypeBuilder.cs (modified) (10 diffs)
-
src/core/OpenRasta/TypeSystem/TypeExtensions.cs (modified) (1 diff)
-
src/core/OpenRasta/Web/HttpEntity.cs (modified) (2 diffs)
-
src/core/OpenRasta/Web/Markup/Attributes/Annotations/BooleanAttribute.cs (modified) (1 diff)
-
src/core/OpenRasta/Web/Markup/Attributes/Nodes/XhtmlAttributeNode.cs (modified) (8 diffs)
-
src/core/OpenRasta/Web/Markup/Elements/GenericElement.cs (modified) (1 diff)
-
src/core/OpenRasta/Web/Markup/Modules/FormsModule.cs (modified) (1 diff)
-
src/core/OpenRasta/Web/TemplatedUriResolver.cs (modified) (7 diffs)
-
src/core/core.4.5.resharper (modified) (2 diffs)
-
src/sharpview/OpenRasta.Codecs.SharpView.Tests.Unit/SharpView_Specification.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0.3000/reports/nunit/.xml
r423 r425 1 1 <?xml version="1.0" encoding="utf-8" standalone="no"?> 2 2 <!--This file represents the results of running a test suite--> 3 <test-results name="C:\src\caff\openrasta\20rc\bin\tmp\ Debug\net-35\OpenBastard.TestRunner\OpenBastard.TestRunner.dll" total="36" errors="0" failures="0" not-run="0" inconclusive="0" ignored="0" skipped="0" invalid="0" date="2010-01-16" time="16:47:14">3 <test-results name="C:\src\caff\openrasta\20rc\bin\tmp\Release\net-35\OpenBastard.TestRunner\OpenBastard.TestRunner.dll" total="36" errors="0" failures="0" not-run="0" inconclusive="0" ignored="0" skipped="0" invalid="0" date="2010-02-06" time="17:17:21"> 4 4 <environment nunit-version="2.5.1.9189" clr-version="2.0.50727.4927" os-version="Microsoft Windows NT 6.1.7100.0" platform="Win32NT" cwd="C:\src\caff\openrasta\20rc\build" machine-name="CHERENKOV" user="sebastien.lambla" user-domain="CAFFEINEIT" /> 5 5 <culture-info current-culture="en-GB" current-uiculture="en-US" /> 6 <test-suite name="C:\src\caff\openrasta\20rc\bin\tmp\ Debug\net-35\OpenBastard.TestRunner\OpenBastard.TestRunner.dll" executed="True" success="True" time="28.276" asserts="0">6 <test-suite name="C:\src\caff\openrasta\20rc\bin\tmp\Release\net-35\OpenBastard.TestRunner\OpenBastard.TestRunner.dll" executed="True" success="True" time="29.601" asserts="0"> 7 7 <results> 8 <test-suite name="HttpListener environment" executed="True" success="True" time="5. 151" asserts="0">8 <test-suite name="HttpListener environment" executed="True" success="True" time="5.714" asserts="0"> 9 9 <results> 10 <test-suite name="accessing the homepage" executed="True" success="True" time="3. 421" asserts="0">10 <test-suite name="accessing the homepage" executed="True" success="True" time="3.353" asserts="0"> 11 11 <results> 12 <test-case name="OpenBastard.Scenarios.accessing_the_homepage.the_homepage_can_be_retrieved_using_xml" executed="True" success="True" time="3.3 86" asserts="3" />12 <test-case name="OpenBastard.Scenarios.accessing_the_homepage.the_homepage_can_be_retrieved_using_xml" executed="True" success="True" time="3.335" asserts="3" /> 13 13 </results> 14 14 </test-suite> 15 <test-suite name="manipulating users" executed="True" success="True" time="0. 755" asserts="0">15 <test-suite name="manipulating users" executed="True" success="True" time="0.999" asserts="0"> 16 16 <results> 17 <test-case name="OpenBastard.Scenarios.manipulating_users.can_create_a_user" executed="True" success="True" time="0. 571" asserts="4" />18 <test-case name="OpenBastard.Scenarios.manipulating_users.can_delete_user_with_correct_credentials" executed="True" success="True" time="0.1 67" asserts="1" />19 <test-case name="OpenBastard.Scenarios.manipulating_users.cannot_delete_user_with_wrong_credentials" executed="True" success="True" time="0.01 6" asserts="1" />17 <test-case name="OpenBastard.Scenarios.manipulating_users.can_create_a_user" executed="True" success="True" time="0.800" asserts="4" /> 18 <test-case name="OpenBastard.Scenarios.manipulating_users.can_delete_user_with_correct_credentials" executed="True" success="True" time="0.182" asserts="1" /> 19 <test-case name="OpenBastard.Scenarios.manipulating_users.cannot_delete_user_with_wrong_credentials" executed="True" success="True" time="0.015" asserts="1" /> 20 20 </results> 21 21 </test-suite> 22 <test-suite name="uploading files" executed="True" success="True" time="0.1 00" asserts="0">22 <test-suite name="uploading files" executed="True" success="True" time="0.124" asserts="0"> 23 23 <results> 24 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_a_complex_type" executed="True" success="True" time="0.04 5" asserts="10002" />24 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_a_complex_type" executed="True" success="True" time="0.047" asserts="10002" /> 25 25 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_app_octet_stream" executed="True" success="True" time="0.001" asserts="0" /> 26 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_enumerable_multipart" executed="True" success="True" time="0.0 25" asserts="10002" />27 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_ifile" executed="True" success="True" time="0.01 3" asserts="10002" />28 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_file_with_specific_content_type" executed="True" success="True" time="0.01 4" asserts="10002" />26 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_enumerable_multipart" executed="True" success="True" time="0.039" asserts="10002" /> 27 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_ifile" executed="True" success="True" time="0.017" asserts="10002" /> 28 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_file_with_specific_content_type" executed="True" success="True" time="0.016" asserts="10002" /> 29 29 </results> 30 30 </test-suite> 31 31 </results> 32 32 </test-suite> 33 <test-suite name="IIS 7 - Classic Mode" executed="True" success="True" time="1 1.071" asserts="0">33 <test-suite name="IIS 7 - Classic Mode" executed="True" success="True" time="12.532" asserts="0"> 34 34 <results> 35 <test-suite name="accessing the homepage" executed="True" success="True" time=" 7.369" asserts="0">35 <test-suite name="accessing the homepage" executed="True" success="True" time="8.610" asserts="0"> 36 36 <results> 37 <test-case name="OpenBastard.Scenarios.accessing_the_homepage.the_homepage_can_be_retrieved_using_xml" executed="True" success="True" time=" 7.369" asserts="3" />37 <test-case name="OpenBastard.Scenarios.accessing_the_homepage.the_homepage_can_be_retrieved_using_xml" executed="True" success="True" time="8.609" asserts="3" /> 38 38 </results> 39 39 </test-suite> 40 <test-suite name="manipulating users" executed="True" success="True" time="0.8 10" asserts="0">40 <test-suite name="manipulating users" executed="True" success="True" time="0.836" asserts="0"> 41 41 <results> 42 <test-case name="OpenBastard.Scenarios.manipulating_users.can_create_a_user" executed="True" success="True" time="0.73 9" asserts="4" />43 <test-case name="OpenBastard.Scenarios.manipulating_users.can_delete_user_with_correct_credentials" executed="True" success="True" time="0.0 63" asserts="1" />44 <test-case name="OpenBastard.Scenarios.manipulating_users.cannot_delete_user_with_wrong_credentials" executed="True" success="True" time="0.0 07" asserts="1" />42 <test-case name="OpenBastard.Scenarios.manipulating_users.can_create_a_user" executed="True" success="True" time="0.735" asserts="4" /> 43 <test-case name="OpenBastard.Scenarios.manipulating_users.can_delete_user_with_correct_credentials" executed="True" success="True" time="0.088" asserts="1" /> 44 <test-case name="OpenBastard.Scenarios.manipulating_users.cannot_delete_user_with_wrong_credentials" executed="True" success="True" time="0.012" asserts="1" /> 45 45 </results> 46 46 </test-suite> 47 <test-suite name="uploading files" executed="True" success="True" time="0.1 14" asserts="0">47 <test-suite name="uploading files" executed="True" success="True" time="0.185" asserts="0"> 48 48 <results> 49 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_a_complex_type" executed="True" success="True" time="0.0 40" asserts="10002" />49 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_a_complex_type" executed="True" success="True" time="0.071" asserts="10002" /> 50 50 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_app_octet_stream" executed="True" success="True" time="0.000" asserts="0" /> 51 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_enumerable_multipart" executed="True" success="True" time="0.0 24" asserts="10002" />52 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_ifile" executed="True" success="True" time="0.0 29" asserts="10002" />53 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_file_with_specific_content_type" executed="True" success="True" time="0.0 18" asserts="10002" />51 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_enumerable_multipart" executed="True" success="True" time="0.046" asserts="10002" /> 52 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_ifile" executed="True" success="True" time="0.039" asserts="10002" /> 53 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_file_with_specific_content_type" executed="True" success="True" time="0.026" asserts="10002" /> 54 54 </results> 55 55 </test-suite> 56 56 </results> 57 57 </test-suite> 58 <test-suite name="IIS 7 - Integrated Mode" executed="True" success="True" time="11. 934" asserts="0">58 <test-suite name="IIS 7 - Integrated Mode" executed="True" success="True" time="11.193" asserts="0"> 59 59 <results> 60 <test-suite name="accessing the homepage" executed="True" success="True" time=" 8.108" asserts="0">60 <test-suite name="accessing the homepage" executed="True" success="True" time="7.668" asserts="0"> 61 61 <results> 62 <test-case name="OpenBastard.Scenarios.accessing_the_homepage.the_homepage_can_be_retrieved_using_xml" executed="True" success="True" time=" 8.108" asserts="3" />62 <test-case name="OpenBastard.Scenarios.accessing_the_homepage.the_homepage_can_be_retrieved_using_xml" executed="True" success="True" time="7.668" asserts="3" /> 63 63 </results> 64 64 </test-suite> 65 <test-suite name="manipulating users" executed="True" success="True" time=" 1.013" asserts="0">65 <test-suite name="manipulating users" executed="True" success="True" time="0.652" asserts="0"> 66 66 <results> 67 <test-case name="OpenBastard.Scenarios.manipulating_users.can_create_a_user" executed="True" success="True" time="0. 685" asserts="4" />68 <test-case name="OpenBastard.Scenarios.manipulating_users.can_delete_user_with_correct_credentials" executed="True" success="True" time="0. 265" asserts="1" />69 <test-case name="OpenBastard.Scenarios.manipulating_users.cannot_delete_user_with_wrong_credentials" executed="True" success="True" time="0.0 62" asserts="1" />67 <test-case name="OpenBastard.Scenarios.manipulating_users.can_create_a_user" executed="True" success="True" time="0.576" asserts="4" /> 68 <test-case name="OpenBastard.Scenarios.manipulating_users.can_delete_user_with_correct_credentials" executed="True" success="True" time="0.065" asserts="1" /> 69 <test-case name="OpenBastard.Scenarios.manipulating_users.cannot_delete_user_with_wrong_credentials" executed="True" success="True" time="0.010" asserts="1" /> 70 70 </results> 71 71 </test-suite> 72 <test-suite name="uploading files" executed="True" success="True" time="0.1 51" asserts="0">72 <test-suite name="uploading files" executed="True" success="True" time="0.182" asserts="0"> 73 73 <results> 74 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_a_complex_type" executed="True" success="True" time="0.0 74" asserts="10002" />75 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_app_octet_stream" executed="True" success="True" time="0.00 2" asserts="0" />76 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_enumerable_multipart" executed="True" success="True" time="0.0 26" asserts="10002" />77 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_ifile" executed="True" success="True" time="0.0 30" asserts="10002" />78 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_file_with_specific_content_type" executed="True" success="True" time="0.0 18" asserts="10002" />74 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_a_complex_type" executed="True" success="True" time="0.056" asserts="10002" /> 75 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_app_octet_stream" executed="True" success="True" time="0.000" asserts="0" /> 76 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_enumerable_multipart" executed="True" success="True" time="0.055" asserts="10002" /> 77 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_ifile" executed="True" success="True" time="0.047" asserts="10002" /> 78 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_file_with_specific_content_type" executed="True" success="True" time="0.022" asserts="10002" /> 79 79 </results> 80 80 </test-suite> 81 81 </results> 82 82 </test-suite> 83 <test-suite name="In memory environment" executed="True" success="True" time="0. 089" asserts="0">83 <test-suite name="In memory environment" executed="True" success="True" time="0.138" asserts="0"> 84 84 <results> 85 <test-suite name="accessing the homepage" executed="True" success="True" time="0.01 2" asserts="0">85 <test-suite name="accessing the homepage" executed="True" success="True" time="0.017" asserts="0"> 86 86 <results> 87 <test-case name="OpenBastard.Scenarios.accessing_the_homepage.the_homepage_can_be_retrieved_using_xml" executed="True" success="True" time="0.01 1" asserts="3" />87 <test-case name="OpenBastard.Scenarios.accessing_the_homepage.the_homepage_can_be_retrieved_using_xml" executed="True" success="True" time="0.015" asserts="3" /> 88 88 </results> 89 89 </test-suite> 90 <test-suite name="manipulating users" executed="True" success="True" time="0.0 13" asserts="0">90 <test-suite name="manipulating users" executed="True" success="True" time="0.028" asserts="0"> 91 91 <results> 92 <test-case name="OpenBastard.Scenarios.manipulating_users.can_create_a_user" executed="True" success="True" time="0.00 6" asserts="4" />93 <test-case name="OpenBastard.Scenarios.manipulating_users.can_delete_user_with_correct_credentials" executed="True" success="True" time="0.0 03" asserts="1" />94 <test-case name="OpenBastard.Scenarios.manipulating_users.cannot_delete_user_with_wrong_credentials" executed="True" success="True" time="0.00 2" asserts="1" />92 <test-case name="OpenBastard.Scenarios.manipulating_users.can_create_a_user" executed="True" success="True" time="0.005" asserts="4" /> 93 <test-case name="OpenBastard.Scenarios.manipulating_users.can_delete_user_with_correct_credentials" executed="True" success="True" time="0.017" asserts="1" /> 94 <test-case name="OpenBastard.Scenarios.manipulating_users.cannot_delete_user_with_wrong_credentials" executed="True" success="True" time="0.003" asserts="1" /> 95 95 </results> 96 96 </test-suite> 97 <test-suite name="uploading files" executed="True" success="True" time="0.0 47" asserts="0">97 <test-suite name="uploading files" executed="True" success="True" time="0.068" asserts="0"> 98 98 <results> 99 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_a_complex_type" executed="True" success="True" time="0.01 0" asserts="10002" />99 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_a_complex_type" executed="True" success="True" time="0.018" asserts="10002" /> 100 100 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_app_octet_stream" executed="True" success="True" time="0.000" asserts="0" /> 101 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_enumerable_multipart" executed="True" success="True" time="0.01 2" asserts="10002" />102 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_ifile" executed="True" success="True" time="0.01 2" asserts="10002" />103 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_file_with_specific_content_type" executed="True" success="True" time="0.01 1" asserts="10002" />101 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_enumerable_multipart" executed="True" success="True" time="0.018" asserts="10002" /> 102 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_ifile" executed="True" success="True" time="0.015" asserts="10002" /> 103 <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_file_with_specific_content_type" executed="True" success="True" time="0.014" asserts="10002" /> 104 104 </results> 105 105 </test-suite> -
branches/2.0.3000/src/core/OpenRasta.Net35/Web/Markup/ExpressionTreeXhtmlExtensions.cs
r323 r425 57 57 public static ISelectElement Select(this IXhtmlAnchor hook, Expression<Func<object>> propertyName, IEnumerable<string> options) 58 58 { 59 return Select(hook, propertyName, options.Select(val => Document.CreateElement<IOptionElement>()[val]) );59 return Select(hook, propertyName, options.Select(val => Document.CreateElement<IOptionElement>()[val]).ToList()); 60 60 } 61 61 public static ISelectElement Select(this IXhtmlAnchor hook, Expression<Func<object>> propertyName, IDictionary<string, string> options) 62 62 { 63 return Select(hook, propertyName, options.Select(kv => Document.CreateElement<IOptionElement>().Value(kv.Key)[kv.Value]) );63 return Select(hook, propertyName, options.Select(kv => Document.CreateElement<IOptionElement>().Value(kv.Key)[kv.Value]).ToList()); 64 64 } 65 65 public static ISelectElement Select(this IXhtmlAnchor hook, Expression<Func<object>> propertyName, IEnumerable<IOptionElement> options) 66 66 { 67 67 var et = new PropertyPathForInstance<object>(propertyName); 68 69 68 70 var select = Document.CreateElement<ISelectElement>().Name(et.FullPath); 69 71 //TODOD: Special case multiple values … … 123 125 { 124 126 return Select<T>(hook, propertyName, 125 options.Select(val => Document.CreateElement<IOptionElement>()[val]) );127 options.Select(val => Document.CreateElement<IOptionElement>()[val]).ToList()); 126 128 } 127 129 -
branches/2.0.3000/src/core/OpenRasta.Tests.Integration/Binding/CustomSurrogates.cs
r423 r425 1 using System.Net; 1 using System; 2 using System.Net; 2 3 using System.Text; 4 using DigestAuthentication_Specification; 3 5 using NUnit.Framework; 4 6 using OpenRasta.Configuration; … … 8 10 using OpenRasta.Testing; 9 11 using OpenRasta.Tests.Integration; 12 using OpenRasta.TypeSystem; 13 using OpenRasta.TypeSystem.Surrogates; 14 using OpenRasta.TypeSystem.Surrogates.Static; 10 15 using OpenRasta.Web; 11 16 12 namespace D igestAuthentication_Specification17 namespace Dynamic_surrogates 13 18 { 14 public class when_using_the_correct_credentials : context.http_digest_context19 public class adding_custom_surrogate : context.surrogates_context 15 20 { 16 21 17 [Test ]18 public void a_protected_resource_fails_with_unauthorized_error_when_no_credentials_are_provided()22 [Test, Ignore("not implemented yet.")] 23 public void surrogate_is_used() 19 24 { 20 given_request("GET", "/ protected");25 given_request("GET", "/customer/3"); 21 26 22 27 when_reading_response(); 23 28 24 TheResponse.StatusCode.ShouldBe(HttpStatusCode.Unauthorized);25 }26 27 [Test]28 public void the_user_authentication_is_successfull_on_URIs_with_encoded_characters()29 {30 given_client_credentials("username", "password");31 given_request("GET", "/café");32 when_reading_response_as_a_string(Encoding.ASCII);33 34 TheResponse.StatusCode.ShouldBe(HttpStatusCode.OK);35 }36 37 [Test]38 public void the_user_is_authenticated_and_a_200_response_is_returned()39 {40 given_client_credentials("username", "password");41 given_request("GET", "/home");42 when_reading_response_as_a_string(Encoding.ASCII);43 44 TheResponse.StatusCode.ShouldBe(HttpStatusCode.OK);45 29 } 46 30 } 47 public class when_using_incorrect_credentials : context.http_digest_context 31 32 public class MySurrogate : AbstractStaticSurrogate<Customer> 48 33 { 49 [Test] 50 public void a_request_for_a_protected_resource_fails_with_401_response() 34 public int Id 51 35 { 52 given_client_credentials("username", "wrongpassword"); 53 given_request("GET", "/home"); 36 get { return 0; } 37 set{throw new InvalidOperationException();} 38 } 39 } 54 40 55 when_reading_response();56 57 TheResponse.StatusCode.ShouldBe(HttpStatusCode.Unauthorized);58 59 when_reading_response();60 61 TheResponse.StatusCode.ShouldBe(HttpStatusCode.Unauthorized);62 }63 [Test]64 public void an_unprotected_resource_returns_200_even_with_invalid_credentials()65 {66 given_client_credentials("username", "wrongpassword");67 given_request("GET", "/unprotected");68 69 when_reading_response_as_a_string(Encoding.ASCII);70 71 TheResponse.StatusCode.ShouldBe(HttpStatusCode.OK);72 }73 74 }75 41 namespace context 76 42 { 77 public class http_digest_context : server_context43 public abstract class surrogates_context : server_context 78 44 { 79 45 80 public http_digest_context()46 public surrogates_context() 81 47 { 82 48 ConfigureServer(() => … … 86 52 87 53 ResourceSpace.Has.ResourcesOfType<Customer>() 88 .AtUri("/{somewhere}") 89 .AndAt("/unprotected").Named("unprotected") 90 .HandledBy<ProtectedCustomerHandler>(); 54 .AtUri("/customer/{id}") 55 .HandledBy<Handler>(); 56 57 ResourceSpace.Uses.CustomDependency<ISurrogateBuilder, MySurrogate>(DependencyLifetime.Transient); 91 58 }); 92 59 } 93 60 } 94 61 } 95 public class FakeAuthProvider : IAuthenticationProvider 62 63 public class Handler 96 64 { 97 public Credentials GetByUsername(string username) 98 { 99 return new Credentials { Username = username, Password = "password" }; 100 } 101 } 102 103 public class ProtectedCustomerHandler 104 { 105 [RequiresAuthentication] 106 public OperationResult Get(string somewhere) 65 public OperationResult Get(Customer customer) 107 66 { 108 67 return new OperationResult.OK(); 109 68 } 110 69 111 [HttpOperation(ForUriName = "unprotected")]112 public OperationResult Get()113 {114 return new OperationResult.OK();115 }116 70 } 117 71 } -
branches/2.0.3000/src/core/OpenRasta.Tests.Integration/OpenRasta.Tests.Integration.csproj
r406 r425 63 63 <Link>Properties\CommonInfo.cs</Link> 64 64 </Compile> 65 <Compile Include="Binding\CustomSurrogates.cs" /> 65 66 <Compile Include="Regressions\92.cs" /> 66 67 <Compile Include="Codecs\HtmlForm_Specification.cs" /> … … 98 99 </ProjectReference> 99 100 </ItemGroup> 100 <ItemGroup>101 <Folder Include="Binding\" />102 </ItemGroup>103 101 <Import Project="..\..\..\build\defaults.targets" /> 104 102 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Binding/DefaultBinderLocator_Specification.cs
r314 r425 18 18 public void the_binder_is_created_correctly() 19 19 { 20 var type = new ReflectionBasedTypeSystem().FromClr(typeof(ClassWithStaticBinder));20 var type = TypeSystems.Default.FromClr(typeof(ClassWithStaticBinder)); 21 21 var binderLocator = new DefaultObjectBinderLocator(); 22 22 -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Binding/KeyedValuesBinder_Specification.cs
r359 r425 121 121 customer.Orders[2].IsSelected.ShouldBeFalse(); 122 122 } 123 [Test] 124 public void multiple_values_with_the_same_name_for_an_icollection_appends_to_the_collection() 125 { 126 var binder = new KeyedValuesBinder(TypeOf<Customer>(), "firstname"); 127 ValueConverter<string> valueConverter = (str, type) => BindingResult.Success(type.CreateInstanceFrom(str)); 128 binder.SetProperty("Attributes", new[] { "blue eyes" }, valueConverter) 129 .ShouldBeTrue(); 130 binder.SetProperty("Attributes", new[] { "green eyes" }, valueConverter) 131 .ShouldBeTrue(); 132 133 var customer = binder.BuildObject().Instance as Customer; 134 customer.Attributes.Count().ShouldBe(2); 135 customer.Attributes.First().ShouldBe("blue eyes"); 136 customer.Attributes.Skip(1).First().ShouldBe("green eyes"); 137 } 123 138 protected IType TypeOf<T>() 124 139 { 125 return new ReflectionBasedTypeSystem().FromClr(typeof(T));140 return TypeSystems.Default.FromClr(typeof(T)); 126 141 } 127 142 } -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Codecs/ApplicationXWwwUrlformEncodedCodec_Specification.cs
r369 r425 161 161 .ShouldBe("John"); 162 162 customer.LastName 163 .ShouldBe("Doe");163 .ShouldBe("Doe"); 164 164 165 165 customer.DateOfBirth.Day 166 166 .ShouldBe(10); 167 } 168 [Test] 169 public void indexers_are_supported_when_encoded() 170 { 171 given_context(); 172 given_request_stream("Customer.Attributes%3A1=blue&Customer.Attributes%3A2=red"); 173 174 when_decoding<Customer>(); 175 176 then_decoding_result<Customer>() 177 .Attributes.Count().ShouldBe(2); 167 178 } 168 179 … … 183 194 public string FirstName { get; set; } 184 195 public string LastName { get; set; } 196 public IEnumerable<string> Attributes { get; set; } 185 197 public DateTime DateOfBirth { get; set; } 186 198 public Address Address { get; set; } -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Codecs/CodecMatch_Specification.cs
r314 r425 69 69 new CodecRegistration( 70 70 typeof (string), 71 new ReflectionBasedTypeSystem().FromClr(typeof (object)), new MediaType(mediaType)), score, matchingParameters);71 TypeSystems.Default.FromClr(typeof (object)), new MediaType(mediaType)), score, matchingParameters); 72 72 } 73 73 } -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Codecs/CodecRepository_Specification.cs
r348 r425 152 152 public class when_searching_for_content_type_writers_for_a_media_type : codec_repository_context 153 153 { 154 readonly ITypeSystem typeSystem = new ReflectionBasedTypeSystem();154 readonly ITypeSystem typeSystem = TypeSystems.Default; 155 155 new IList<CodecRegistration> ThenTheResult; 156 156 … … 264 264 public CodecRegistration ThenTheResult; 265 265 public CodecMatch ThenTheResultScoring; 266 public ITypeSystem TypeSystem = new ReflectionBasedTypeSystem();266 public ITypeSystem TypeSystem = TypeSystems.Default; 267 267 268 268 [SetUp] … … 286 286 Codecs.Add(CodecRegistration.FromResourceType(resourceType, 287 287 typeof(TCodec), 288 new ReflectionBasedTypeSystem(),288 TypeSystems.Default, 289 289 mediaType, 290 290 null, -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Codecs/MultipartFormDataCodec_Specification.cs
r348 r425 302 302 DependencyManager.Codecs, 303 303 DependencyManager.GetService<IDependencyResolver>(), 304 new ReflectionBasedTypeSystem(),304 TypeSystems.Default, 305 305 new DefaultObjectBinderLocator()); 306 306 } -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Codecs/media_type_reader_context.cs
r369 r425 79 79 var codec = codecInstance as IMediaTypeReader; 80 80 if (codec != null) 81 _theResult = codec.ReadFrom(Context.Request.Entity, new ReflectionBasedTypeSystem().FromClr(typeof(T)), paramName);81 _theResult = codec.ReadFrom(Context.Request.Entity,TypeSystems.Default.FromClr(typeof(T)), paramName); 82 82 else 83 83 { -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Configuration/LegacyManualConfiguration_Specification.cs
r362 r425 33 33 match.ShouldNotBeNull(); 34 34 match.UriCulture.ShouldBe(language); 35 match.ResourceKey.ShouldBe( new ReflectionBasedTypeSystem().FromClr(typeof(TResource)));35 match.ResourceKey.ShouldBe(TypeSystems.Default.FromClr(typeof(TResource))); 36 36 match.UriName.ShouldBe(name); 37 37 } … … 77 77 { 78 78 return 79 DependencyManager.Codecs.Where(codec => codec.ResourceType.CompareTo( new ReflectionBasedTypeSystem().FromClr(typeof (TResource)))==0 && codec.CodecType == typeof (TCodec) && codec.MediaType.MediaType == mediaType).79 DependencyManager.Codecs.Where(codec => codec.ResourceType.CompareTo(TypeSystems.Default.FromClr(typeof (TResource)))==0 && codec.CodecType == typeof (TCodec) && codec.MediaType.MediaType == mediaType). 80 80 Distinct().SingleOrDefault(); 81 81 } … … 179 179 var handlerMatch = DependencyManager.Handlers.GetHandlerTypesFor(urimatch.ResourceKey).FirstOrDefault(); 180 180 handlerMatch.ShouldNotBeNull(); 181 handlerMatch.ShouldBe( new ReflectionBasedTypeSystem().FromClr(typeof(THandler)));181 handlerMatch.ShouldBe(TypeSystems.Default.FromClr(typeof(THandler))); 182 182 return handlerMatch; 183 183 } -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Configuration/MetaModelHandler_Specification.cs
r362 r425 136 136 137 137 Handler.Process(MetaModel); 138 var typeSystem = new ReflectionBasedTypeSystem().FromClr(typeof(Customer));138 var typeSystem = TypeSystems.Default.FromClr(typeof(Customer)); 139 139 var registeredHandlers = HandlerRepository.GetHandlerTypesFor(typeSystem); 140 140 … … 146 146 void given_handler_registration() 147 147 { 148 var typeSystem = new ReflectionBasedTypeSystem();148 var typeSystem = TypeSystems.Default; 149 149 MetaModel.ResourceRegistrations.Add(new ResourceModel 150 150 { … … 160 160 public class when_registering_non_IType_resource_keys : metamodelhandler_context<TypeRewriterMetaModelHandler> 161 161 { 162 ReflectionBasedTypeSystem TypeSystem;163 164 protected override void SetUp() 165 { 166 base.SetUp(); 167 TypeSystem = new ReflectionBasedTypeSystem();162 ITypeSystem TypeSystem; 163 164 protected override void SetUp() 165 { 166 base.SetUp(); 167 TypeSystem = TypeSystems.Default; 168 168 Handler = new TypeRewriterMetaModelHandler(TypeSystem); 169 169 } … … 238 238 void given_unknown_type_registered_as_codec() 239 239 { 240 var typeSystem = new ReflectionBasedTypeSystem();240 var typeSystem = TypeSystems.Default; 241 241 MetaModel.ResourceRegistrations.Add(new ResourceModel 242 242 { … … 251 251 void given_codec_registration() 252 252 { 253 var typeSystem = new ReflectionBasedTypeSystem();253 var typeSystem = TypeSystems.Default; 254 254 MetaModel.ResourceRegistrations.Add(new ResourceModel 255 255 { -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Configuration/MetaModel_Specification.cs
r406 r425 89 89 public void a_resource_with_IType_is_registered() 90 90 { 91 ResourceSpaceHas.ResourcesOfType( new ReflectionBasedTypeSystem().FromClr(typeof(Customer)));91 ResourceSpaceHas.ResourcesOfType(TypeSystems.Default.FromClr(typeof(Customer))); 92 92 93 93 MetaModel.ResourceRegistrations[0].ResourceKey.ShouldBeOfType<IType>().Name.ShouldBe("Customer"); … … 209 209 { 210 210 ResourceSpaceHas.ResourcesOfType(typeof(Frodo)).AtUri("/theshrine") 211 .HandledBy( new ReflectionBasedTypeSystem().FromClr(typeof(CustomerHandler)));211 .HandledBy(TypeSystems.Default.FromClr(typeof(CustomerHandler))); 212 212 FirstRegistration.Handlers[0].Name.ShouldBe("CustomerHandler"); 213 213 } -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Fakes/Customer.cs
r300 r425 25 25 { 26 26 public List<Order> Orders { get; set; } 27 public ICollection<string> Attributes { get; set; } 27 28 } 28 29 -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/OpenRasta.Tests.Unit.csproj
r406 r425 116 116 <Compile Include="TypeSystem\PropertyPathManager_Specification.cs" /> 117 117 <Compile Include="TypeSystem\ReflectionExtensions_Specification.cs" /> 118 <Compile Include="TypeSystem\Surrogate2_Specification.cs" /> 118 119 <Compile Include="TypeSystem\Surrogates_Specification.cs" /> 119 120 <Compile Include="Text\Rfc2047Encoding_Specification.cs" /> -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/OperationModel/CodecSelectors/RequestCodecSelector_Specification.cs
r317 r425 4 4 using System.Runtime.InteropServices; 5 5 using NUnit.Framework; 6 using OpenRasta.Binding; 6 7 using OpenRasta.Codecs; 7 8 using OpenRasta.OperationModel; … … 9 10 using OpenRasta.OperationModel.Hydrators; 10 11 using OpenRasta.Testing; 12 using OpenRasta.Tests.Unit.Fakes; 11 13 using OpenRasta.Tests.Unit.OperationModel.Filters; 12 14 using OpenRasta.Web; … … 76 78 FilteredOperations.First(x => x.Name == "Get").GetRequestCodec().ShouldBeNull(); 77 79 } 80 [Test] 81 public void operations_with_partially_filled_members_still_get_codec_assigned() 82 { 83 given_filter(); 84 given_operations(); 85 given_request_header_content_type(MediaType.ApplicationXWwwFormUrlencoded); 86 87 given_registration_codec<ApplicationXWwwFormUrlencodedKeyedValuesCodec>(); 88 given_request_entity_body("firstname=Frodo"); 89 90 given_operation_property(x => x.Name == "GetFrodo", "lastname", "baggins"); 91 92 when_filtering_operations(); 93 94 FilteredOperations.First(x => x.Name == "GetFrodo").GetRequestCodec() 95 .ShouldNotBeNull() 96 .CodecRegistration.CodecType 97 .ShouldBe<ApplicationXWwwFormUrlencodedKeyedValuesCodec>(); 98 } 99 100 void given_operation_property(Func<IOperation, bool> predicate, string propertyName, string propertyValue) 101 { 102 Operations.First(predicate).Inputs.First().Binder.SetProperty( 103 propertyName, 104 new object[]{propertyValue}, 105 (v,t)=>BindingResult.Success(v)); 106 } 78 107 } 79 108 public class when_a_codec_is_not_found : requestcodecselector_context … … 117 146 } 118 147 public void GetWithOptionalValue([Optional]int optionalIndex){} 148 149 public void GetFrodo(Frodo frodo) 150 { 151 152 } 119 153 } 120 154 } -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/TypeSystem/Instances_Specification.cs
r314 r425 16 16 using OpenRasta.Testing; 17 17 using OpenRasta.Tests.Unit.Fakes; 18 using OpenRasta.Tests.Unit.TypeSystem; 18 19 using OpenRasta.TypeSystem; 19 20 using OpenRasta.TypeSystem.ReflectionBased; 21 using Frodo=OpenRasta.Tests.Unit.Fakes.Frodo; 20 22 21 23 namespace Instances_Specification … … 26 28 public void cannot_assign_properties_to_a_null_object() 27 29 { 28 GivenTypeInstance<Customer>();29 30 Executing(() => T henTypeBuilder.Apply(null)).ShouldThrow<ArgumentNullException>();30 given_builder_for<Customer>(); 31 32 Executing(() => TypeBuilder.Update(null)).ShouldThrow<ArgumentNullException>(); 31 33 } 32 34 … … 34 36 public void the_properties_are_assigned() 35 37 { 36 GivenTypeInstance<Customer>();37 GivenProperty("username", "johndoe");38 given_builder_for<Customer>(); 39 given_property("username", "johndoe"); 38 40 39 41 var newCustomer = new Customer {FirstName = "John"}; 40 42 41 T henTypeBuilder.Apply(newCustomer);43 TypeBuilder.Update(newCustomer); 42 44 43 45 newCustomer.Username.ShouldBe("johndoe"); 44 46 newCustomer.FirstName.ShouldBe("John"); 45 47 46 GivenProperty("lastname", "doe");48 given_property("lastname", "doe"); 47 49 newCustomer = new Customer {FirstName = "John"}; 48 T henTypeBuilder.Apply(newCustomer);50 TypeBuilder.Update(newCustomer); 49 51 50 52 newCustomer.Username.ShouldBe("johndoe"); … … 59 61 public void a_property_retrieved_twice_retrieves_the_same_object() 60 62 { 61 GivenTypeInstance<string>();62 63 T henTypeBuilder.GetProperty("Length").ShouldBeTheSameInstanceAs(ThenTypeBuilder.GetProperty("Length"));63 given_builder_for<string>(); 64 65 TypeBuilder.GetProperty("Length").ShouldBeTheSameInstanceAs(TypeBuilder.GetProperty("Length")); 64 66 } 65 67 … … 67 69 public void a_readonly_property_is_returned_as_non_writable() 68 70 { 69 GivenTypeInstance<string>();70 71 T henTypeBuilder.GetProperty("Length").CanWrite.ShouldBeFalse();71 given_builder_for<string>(); 72 73 TypeBuilder.GetProperty("Length").CanWrite.ShouldBeFalse(); 72 74 } 73 75 … … 75 77 public void an_unknown_property_returns_null() 76 78 { 77 GivenTypeInstance<string>();78 79 T henTypeBuilder.GetProperty("unknown").ShouldBeNull();79 given_builder_for<string>(); 80 81 TypeBuilder.GetProperty("unknown").ShouldBeNull(); 80 82 } 81 83 } … … 86 88 public void a_property_retrieved_but_wihtout_a_value_is_not_present_in_the_changes() 87 89 { 88 GivenTypeInstance<Customer>();89 90 T henTypeBuilder.GetProperty("FirstName")90 given_builder_for<Customer>(); 91 92 TypeBuilder.GetProperty("FirstName") 91 93 .TrySetValue(2).ShouldBeFalse(); 92 94 93 T henTypeBuilder.Changes.Count.ShouldBe(0);95 TypeBuilder.Changes.Count.ShouldBe(0); 94 96 } 95 97 … … 97 99 public void a_successfully_assigned_property_is_present_in_the_list_of_changes() 98 100 { 99 GivenTypeInstance<Customer>();100 101 T henTypeBuilder.GetProperty("FirstName").TrySetValue("Frodo");102 103 T henTypeBuilder.Changes.Count.ShouldBe(1);104 T henTypeBuilder.Changes.ContainsKey("FirstName").ShouldBeTrue();101 given_builder_for<Customer>(); 102 103 TypeBuilder.GetProperty("FirstName").TrySetValue("Frodo"); 104 105 TypeBuilder.Changes.Count.ShouldBe(1); 106 TypeBuilder.Changes.ContainsKey("FirstName").ShouldBeTrue(); 105 107 } 106 108 … … 108 110 public void accessing_the_indexer_with_an_unknown_key_throws() 109 111 { 110 GivenTypeInstance<Customer>();111 Executing(() => { IPropertyBuilder value = T henTypeBuilder.Changes["firstname"]; })112 given_builder_for<Customer>(); 113 Executing(() => { IPropertyBuilder value = TypeBuilder.Changes["firstname"]; }) 112 114 .ShouldThrow<ArgumentOutOfRangeException>(); 113 115 } … … 116 118 public void the_change_list_is_readonly() 117 119 { 118 GivenTypeInstance<Customer>();119 120 T henTypeBuilder.Changes.IsReadOnly.ShouldBeTrue();121 Executing(() => T henTypeBuilder.Changes.Add(null, null))120 given_builder_for<Customer>(); 121 122 TypeBuilder.Changes.IsReadOnly.ShouldBeTrue(); 123 Executing(() => TypeBuilder.Changes.Add(null, null)) 122 124 .ShouldThrow<NotSupportedException>(); 123 125 124 Executing(() => T henTypeBuilder.Changes.Remove(null))126 Executing(() => TypeBuilder.Changes.Remove(null)) 125 127 .ShouldThrow<NotSupportedException>(); 126 128 127 Executing(() => T henTypeBuilder.Changes["bla"] = null)129 Executing(() => TypeBuilder.Changes["bla"] = null) 128 130 .ShouldThrow<NotSupportedException>(); 129 131 } … … 132 134 public void the_keys_are_case_insensitive() 133 135 { 134 GivenTypeInstance<Customer>();135 T henTypeBuilder.GetProperty("FirstName")136 given_builder_for<Customer>(); 137 TypeBuilder.GetProperty("FirstName") 136 138 .TrySetValue("Frodo"); 137 T henTypeBuilder.Changes["firstname"].Value.ShouldBe("Frodo");139 TypeBuilder.Changes["firstname"].Value.ShouldBe("Frodo"); 138 140 } 139 141 } … … 144 146 public void a_property_is_not_set_when_the_type_is_incompatible() 145 147 { 146 GivenTypeInstance<Customer>();147 148 T henTypeBuilder.GetProperty("Username").TrySetValue(3).ShouldBeFalse();148 given_builder_for<Customer>(); 149 150 TypeBuilder.GetProperty("Username").TrySetValue(3).ShouldBeFalse(); 149 151 } 150 152 … … 152 154 public void a_writable_property_is_set_and_its_value_can_be_retrieved() 153 155 { 154 GivenTypeInstance<Customer>();155 156 T henTypeBuilder.GetProperty("Username").TrySetValue("hello")156 given_builder_for<Customer>(); 157 158 TypeBuilder.GetProperty("Username").TrySetValue("hello") 157 159 .ShouldBeTrue(); 158 160 159 T henTypeBuilder.GetProperty("Username")161 TypeBuilder.GetProperty("Username") 160 162 .Value.ShouldBe("hello"); 161 163 } … … 172 174 public void a_new_instance_is_created_when_using_create() 173 175 { 174 GivenTypeInstance<Customer>();175 Customer customer = T henTypeBuilder.Create().ShouldBeOfType<Customer>().ShouldNotBeNull();176 177 T henTypeBuilder.GetProperty("FirstName").TrySetValue("Frodo")176 given_builder_for<Customer>(); 177 Customer customer = TypeBuilder.Create().ShouldBeOfType<Customer>().ShouldNotBeNull(); 178 179 TypeBuilder.GetProperty("FirstName").TrySetValue("Frodo") 178 180 .ShouldBeTrue(); 179 181 180 182 customer.LastName = "Baggins"; 181 customer = T henTypeBuilder.Create() as Customer;183 customer = TypeBuilder.Create() as Customer; 182 184 183 185 customer.FirstName.ShouldBe("Frodo"); … … 188 190 public void assigning_properties_after_the_property_got_assigned_a_parent_updates_the_parent() 189 191 { 190 GivenTypeInstance<Customer>(); 192 given_builder_for<Customer>(); 193 191 194 var customerInstance = new Customer(); 192 T henTypeBuilder.TrySetValue(customerInstance);193 194 IPropertyBuilder firstName = T henTypeBuilder.GetProperty("FirstName");195 firstName.SetOwner(ThenTypeBuilder);195 TypeBuilder.TrySetValue(customerInstance); 196 197 IPropertyBuilder firstName = TypeBuilder.GetProperty("FirstName"); 198 //firstName.SetOwner(TypeBuilder); 196 199 197 200 firstName.TrySetValue(new[] {"Smeagol"}, IdentityConverter); 198 201 202 TypeBuilder.Update(customerInstance); 199 203 customerInstance.FirstName.ShouldBe("Smeagol"); 200 204 } 201 205 202 206 [Test] 203 public void cannot_assign_a_null_parent_to_a_property()204 {205 GivenTypeInstance<Customer>();206 Executing(() => ThenTypeBuilder.GetProperty("FirstName").SetOwner(null))207 .ShouldThrow<ArgumentNullException>();208 }209 210 [Test]211 public void cannot_assign_a_parent_twice()212 {213 GivenTypeInstance<Customer>();214 ThenTypeBuilder.GetProperty("FirstName").SetOwner(ThenTypeBuilder);215 ITypeBuilder newBuilder = new ReflectionBasedType(typeof(Customer)).CreateBuilder();216 Executing(() => ThenTypeBuilder.GetProperty("FirstName").SetOwner(newBuilder))217 .ShouldThrow<InvalidOperationException>();218 }219 220 [Test]221 207 public void no_reference_is_kept_after_a_call_to_apply() 222 208 { 223 GivenTypeInstance<Customer>();209 given_builder_for<Customer>(); 224 210 var customer = new Customer(); 225 T henTypeBuilder.Apply(customer);226 227 T henTypeBuilder.GetProperty("FirstName").TrySetValue("Frodo")211 TypeBuilder.Update(customer); 212 213 TypeBuilder.GetProperty("FirstName").TrySetValue("Frodo") 228 214 .ShouldBeTrue(); 229 215 230 object newCustomer = T henTypeBuilder.Create();216 object newCustomer = TypeBuilder.Create(); 231 217 newCustomer.ShouldNotBeTheSameInstanceAs(customer); 232 218 customer.FirstName.ShouldBe(null); … … 245 231 void WhenCreatingTheObject() 246 232 { 247 _result = T henTypeBuilder.Create();233 _result = TypeBuilder.Create(); 248 234 } 249 235 … … 251 237 public void a_type_instance_can_be_applied_twice() 252 238 { 253 GivenTypeInstance<Customer>();254 GivenProperty("Username", "johndoe");255 256 WhenCreatingTheObject(); 257 258 GivenProperty("FirstName", "John");239 given_builder_for<Customer>(); 240 given_property("Username", "johndoe"); 241 242 WhenCreatingTheObject(); 243 244 given_property("FirstName", "John"); 259 245 WhenCreatingTheObject(); 260 246 … … 266 252 public void a_value_can_be_assigned_to_the_type_instance() 267 253 { 268 GivenTypeInstance<int>();269 270 T henTypeBuilder.TrySetValue(3)254 given_builder_for<int>(); 255 256 TypeBuilder.TrySetValue(3) 271 257 .ShouldBeTrue(); 272 T henTypeBuilder.HasValue.ShouldBeTrue();273 T henTypeBuilder.Value.ShouldBe(3);258 TypeBuilder.HasValue.ShouldBeTrue(); 259 TypeBuilder.Value.ShouldBe(3); 274 260 } 275 261 … … 277 263 public void a_value_of_the_incorrect_type_cannot_be_assinged() 278 264 { 279 GivenTypeInstance<int>();280 281 T henTypeBuilder.TrySetValue("hello")265 given_builder_for<int>(); 266 267 TypeBuilder.TrySetValue("hello") 282 268 .ShouldBeFalse(); 283 269 284 ThenTypeBuilder.HasValue.ShouldBeFalse(); 285 } 286 287 [Test] 288 public void creating_an_object_twice_returns_the_same_object() 289 { 290 GivenTypeInstance<Customer>(); 291 ThenTypeBuilder.Create().ShouldBeTheSameInstanceAs(ThenTypeBuilder.Create()); 292 } 293 270 TypeBuilder.HasValue.ShouldBeFalse(); 271 } 294 272 [Test] 295 273 public void nested_properties_are_assigned() 296 274 { 297 GivenTypeInstance<Customer>();298 GivenProperty("Address.Line1", "Cadbury Street");299 GivenProperty("Address.City", "London");275 given_builder_for<Customer>(); 276 given_property("Address.Line1", "Cadbury Street"); 277 given_property("Address.City", "London"); 300 278 301 279 WhenCreatingTheObject(); … … 308 286 public void setting_properties_on_children_of_indexers_works_as_expected() 309 287 { 310 GivenTypeInstance<House>();311 312 GivenProperty("CustomersByName:john.FirstName", "John");313 GivenProperty("CustomersByName:john.LastName", "Doe");288 given_builder_for<House>(); 289 290 given_property("CustomersByName:john.FirstName", "John"); 291 given_property("CustomersByName:john.LastName", "Doe"); 314 292 WhenCreatingTheObject(); 315 293 ThenTheObject<House>().CustomersByName["john"].FirstName.ShouldBe("John"); … … 320 298 public void the_properties_are_assigned() 321 299 { 322 GivenTypeInstance<Customer>();323 GivenProperty("Username", "johndoe");324 GivenProperty("FirstName", "john");300 given_builder_for<Customer>(); 301 given_property("Username", "johndoe"); 302 given_property("FirstName", "john"); 325 303 326 304 WhenCreatingTheObject(); … … 330 308 } 331 309 332 public class when_assigning_a_value_to_a_parameter_binder : parameter_instance_context 333 { 334 [Test] 335 public void the_parameter_has_a_value() 336 { 337 GivenParameterInstance((int a) => { }); 338 GivenBinderKey("a", 1); 339 340 TheParameter.IsReadyForAssignment.ShouldBeTrue(); 341 } 342 } 343 344 public class when_not_assigning_a_value_to_a_parameter : parameter_instance_context 345 { 346 public void MethodWithOptional([Optional] int a) 347 { 348 } 349 350 [Test] 351 public void an_optional_value_gives_the_parameter_a_value() 352 { 353 GivenParameterInstance<int>(MethodWithOptional); 354 355 TheParameter.IsReadyForAssignment.ShouldBeTrue(); 356 } 357 358 [Test] 359 public void an_unfilled_parameter_doesnt_have_value() 360 { 361 GivenParameterInstance((int a) => { }); 362 363 TheParameter.IsReadyForAssignment.ShouldBeFalse(); 364 } 365 } 366 367 public class parameter_instance_context : instance_context 368 { 369 protected ParameterInstance TheParameter; 370 371 protected void GivenBinderKey<TValue>(string key, TValue value) 372 { 373 TheParameter.Binder.SetProperty(key, new[] {value}, (src, output) => BindingResult.Success(src)) 374 .ShouldBeTrue(); 375 } 376 377 protected void GivenParameterInstance<T>(Action<T> action) 378 { 379 var parameterType = new ReflectionBasedTypeSystem().FromClr(action.Method.GetParameters()[0].ParameterType); 380 TheParameter = new ParameterInstance(new ReflectionParameter(action.Method.GetParameters()[0]), 381 new KeyedValuesBinder( 382 parameterType, 383 action.Method.GetParameters()[0].Name)); 384 } 385 } 386 387 public class instance_context : context 388 { 310 311 public abstract class instance_context : context 312 { 313 protected static ITypeSystem _ts = TypeSystems.Default; 314 public instance_context() 315 { 316 } 389 317 // ITypeSystem _typeSystem = new 390 public void GivenTypeInstance<T1>()391 { 392 T henTypeBuilder = new ReflectionBasedTypeSystem().FromClr(typeof(T1)).CreateBuilder();393 } 394 395 protected ITypeBuilder T henTypeBuilder;396 397 protected void GivenProperty(string prop, object value)398 { 399 T henTypeBuilder.GetProperty(prop).TrySetValue(value).ShouldBeTrue();318 public void given_builder_for<T1>() 319 { 320 TypeBuilder = _ts.FromClr(typeof(T1)).CreateBuilder(); 321 } 322 323 protected ITypeBuilder TypeBuilder; 324 325 protected void given_property(string prop, object value) 326 { 327 TypeBuilder.GetProperty(prop).TrySetValue(value).ShouldBeTrue(); 400 328 } 401 329 } -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/TypeSystem/Members_Specification.cs
r362 r425 20 20 using OpenRasta.TypeSystem; 21 21 using OpenRasta.TypeSystem.ReflectionBased; 22 using OpenRasta.TypeSystem.ReflectionBased.Surrogates;23 22 24 23 namespace Accessors_Specification … … 29 28 public void a_reference_type_can_be_assigned_a_null_value() 30 29 { 31 new ReflectionBasedType( typeof(string)).CanSetValue(null)30 new ReflectionBasedType(_typeSystem,typeof(string)).CanSetValue(null) 32 31 .ShouldBe(true); 33 32 } … … 36 35 public void a_reflection_type_cannot_be_equal_to_null() 37 36 { 38 new ReflectionBasedType( typeof(string)).Equals(null)37 new ReflectionBasedType(_typeSystem,typeof(string)).Equals(null) 39 38 .ShouldBeFalse(); 40 39 } … … 44 43 { 45 44 object result; 46 new ReflectionBasedType( typeof(string)).TryCreateInstance(new[] { "value" }, (str, type) => BindingResult.Success(str), out result)45 new ReflectionBasedType(_typeSystem,typeof(string)).TryCreateInstance(new[] { "value" }, (str, type) => BindingResult.Success(str), out result) 47 46 .ShouldBeTrue(); 48 47 result.ShouldBe("value"); … … 53 52 { 54 53 object result; 55 new ReflectionBasedType( typeof(string)).TryCreateInstance(new[] { "value" }, (str, type) => BindingResult.Failure(), out result)54 new ReflectionBasedType(_typeSystem,typeof(string)).TryCreateInstance(new[] { "value" }, (str, type) => BindingResult.Failure(), out result) 56 55 .ShouldBeFalse(); 57 56 } … … 60 59 public void a_value_type_cannot_be_assigned_a_null_value() 61 60 { 62 new ReflectionBasedType( typeof(int)).CanSetValue(null)61 new ReflectionBasedType(_typeSystem,typeof(int)).CanSetValue(null) 63 62 .ShouldBeFalse(); 64 63 } … … 67 66 public void an_incorrect_type_cannot_be_assigned() 68 67 { 69 new ReflectionBasedType( typeof(int)).CanSetValue("hello")68 new ReflectionBasedType(_typeSystem,typeof(int)).CanSetValue("hello") 70 69 .ShouldBeFalse(); 71 70 } … … 81 80 public void the_name_is_the_type_name() 82 81 { 83 new ReflectionBasedType( typeof(string)).Name82 new ReflectionBasedType(_typeSystem,typeof(string)).Name 84 83 .ShouldBe("String"); 85 84 } … … 88 87 public void two_reflection_based_types_are_equal_if_built_from_the_same_native_type() 89 88 { 90 var type1 = new ReflectionBasedType( typeof(string));91 var type2 = new ReflectionBasedType( typeof(string));89 var type1 = new ReflectionBasedType(_typeSystem,typeof(string)); 90 var type2 = new ReflectionBasedType(_typeSystem,typeof(string)); 92 91 type1.Equals(type2).ShouldBeTrue(); 93 92 type1.GetHashCode().ShouldBe(type2.GetHashCode()); … … 97 96 public void two_reflection_based_types_are_not_equal_if_built_from_different_native_types() 98 97 { 99 var type1 = new ReflectionBasedType( typeof(string));100 var type2 = new ReflectionBasedType( typeof(object));98 var type1 = new ReflectionBasedType(_typeSystem,typeof(string)); 99 var type2 = new ReflectionBasedType(_typeSystem,typeof(object)); 101 100 type1.Equals(type2).ShouldBeFalse(); 102 101 type1.GetHashCode().ShouldNotBe(type2.GetHashCode()); … … 109 108 public void a_type_compared_to_a_null_results_in_minus_one() 110 109 { 111 new ReflectionBasedType( typeof(int)).CompareTo(null)110 new ReflectionBasedType(_typeSystem,typeof(int)).CompareTo(null) 112 111 .ShouldBe(-1); 113 112 } … … 116 115 public void two_types_not_in_an_inheritance_hierarchy_compare_to_minus_one() 117 116 { 118 new ReflectionBasedType( typeof(int)).CompareTo(new ReflectionBasedType(typeof(string)))117 new ReflectionBasedType(_typeSystem,typeof(int)).CompareTo(new ReflectionBasedType(_typeSystem,typeof(string))) 119 118 .ShouldBe(-1); 120 119 } … … 144 143 { 145 144 GivenTypeFor<Type>(); 146 ThenTheProperty("Namespace.Length").T argetType.ShouldBe<int>();145 ThenTheProperty("Namespace.Length").Type.Equals<int>().ShouldBeTrue(); 147 146 } 148 147 … … 152 151 GivenTypeFor<string>(); 153 152 154 ThenTheProperty("Length").T argetType.ShouldBe<int>();153 ThenTheProperty("Length").Type.Equals<int>().ShouldBeTrue(); 155 154 } 156 155 … … 159 158 { 160 159 GivenTypeFor<House>(); 161 ThenTheProperty("Customers:0.FirstName").T argetType.ShouldBe<string>();160 ThenTheProperty("Customers:0.FirstName").Type.Equals<string>().ShouldBeTrue(); 162 161 } 163 162 … … 180 179 { 181 180 GivenTypeFor<House>(); 182 ThenTheProperty("Customers:0").T argetType.ShouldBe<Customer>();181 ThenTheProperty("Customers:0").Type.Equals<Customer>().ShouldBeTrue(); 183 182 } 184 183 … … 232 231 } 233 232 234 ReflectionBasedProperty ThenTheProperty(string propertyName)235 { 236 return T henTheType.GetProperty(propertyName) as ReflectionBasedProperty;233 IProperty ThenTheProperty(string propertyName) 234 { 235 return Type.FindPropertyByPath(propertyName); 237 236 } 238 237 } … … 257 256 GivenTypeFor<RingOfPower>(); 258 257 259 var wornByMethod = T henTheType.GetMethod("WornBy");258 var wornByMethod = Type.GetMethod("WornBy"); 260 259 wornByMethod 261 260 .ShouldNotBeNull() … … 271 270 GivenTypeFor<RingOfPower>(); 272 271 273 T henTheType.GetMethod("WornBy")274 .ShouldBeTheSameInstanceAs(T henTheType.GetMethod("wornby"));272 Type.GetMethod("WornBy") 273 .ShouldBeTheSameInstanceAs(Type.GetMethod("wornby")); 275 274 } 276 275 [Test] … … 279 278 GivenTypeFor<RingOfPower>(); 280 279 281 T henTheType.GetMethod("ToString").Owner.TypeName.ShouldBe("Object");282 } 283 protected ICollection<IMethod> TheMethods { get { return T henTheType.GetMethods(); } }280 Type.GetMethod("ToString").Owner.TypeName.ShouldBe("Object"); 281 } 282 protected ICollection<IMethod> TheMethods { get { return Type.GetMethods(); } } 284 283 } 285 284 … … 292 291 public class when_building_types_from_the_type_system : context 293 292 { 294 readonly ITypeSystem TypeSystem = new ReflectionBasedTypeSystem();293 readonly ITypeSystem TypeSystem = TypeSystems.Default; 295 294 296 295 [Test] … … 311 310 public class IType_context : context 312 311 { 313 protected IType ThenTheType; 312 313 protected ITypeSystem _typeSystem; 314 315 public IType_context() 316 { 317 _typeSystem = TypeSystems.Default; 318 } 319 protected IType Type; 314 320 315 321 protected void GivenTypeFor<TTarget>() 316 322 { 317 T henTheType = TypeForClr<TTarget>();323 Type = TypeForClr<TTarget>(); 318 324 } 319 325 320 326 protected IType TypeForClr<TTarget>() 321 327 { 322 return new ReflectionBasedTypeSystem { SurrogateFactory = new DefaultSurrogateFactory() }.FromClr(typeof(TTarget));328 return _typeSystem.FromClr(typeof(TTarget)); 323 329 } 324 330 } -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/TypeSystem/PropertyPathManager_Specification.cs
r359 r425 6 6 using OpenRasta.Testing; 7 7 using OpenRasta.TypeSystem; 8 using OpenRasta.TypeSystem.ReflectionBased;9 8 10 9 namespace PropertyPathManager_Specification -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/TypeSystem/Surrogates_Specification.cs
r314 r425 11 11 12 12 using System; 13 using System.Collections; 13 14 using System.Collections.Generic; 15 using System.Linq; 14 16 using Instances_Specification; 15 17 using NUnit.Framework; 16 18 using OpenRasta.Testing; 17 19 using OpenRasta.Tests.Unit.Fakes; 20 using OpenRasta.Tests.Unit.TypeSystem; 18 21 using OpenRasta.TypeSystem; 19 22 using OpenRasta.TypeSystem.ReflectionBased; 23 using Frodo = OpenRasta.Tests.Unit.Fakes.Frodo; 20 24 21 25 namespace Surrogates_Specification 22 26 { 23 public class when_using_ListOfT : context 27 28 public class when_using_ListOfT : instance_context 24 29 { 25 30 ITypeBuilder _theBuilder; … … 28 33 public void indexer_values_are_ignored_and_values_are_appended() 29 34 { 30 GivenTypeInstance();35 given_builder(); 31 36 32 37 _theBuilder.GetProperty(":1").TrySetValue("hello").ShouldBeTrue(); 33 38 _theBuilder.GetProperty(":0").TrySetValue("hello2").ShouldBeTrue(); 34 39 35 var theList = (List<string>) _theBuilder.Create();40 var theList = (List<string>)_theBuilder.Create(); 36 41 theList[0].ShouldBe("hello"); 37 42 theList[1].ShouldBe("hello2"); … … 40 45 public void the_indexer_is_surrogated() 41 46 { 42 GivenTypeInstance();47 given_builder(); 43 48 44 49 _theBuilder.GetProperty(":0").TrySetValue("hello") 45 50 .ShouldBeTrue(); 46 51 47 var theList = (List<string>) _theBuilder.Create();52 var theList = (List<string>)_theBuilder.Create(); 48 53 theList[0].ShouldBe("hello"); 49 54 } 50 55 51 void GivenTypeInstance()52 { 53 _theBuilder = new ReflectionBasedTypeSystem().FromClr(typeof(List<string>)).CreateBuilder();54 } 55 } 56 57 public class when_using_ListOfT_as_a_nested_property : context56 void given_builder() 57 { 58 _theBuilder = _ts.FromClr(typeof(List<string>)).CreateBuilder(); 59 } 60 } 61 62 public class when_using_ListOfT_as_a_nested_property : instance_context 58 63 { 59 64 ITypeBuilder _theBuilder; … … 67 72 .ShouldBeTrue(); 68 73 69 var theList = (ListContainer) _theBuilder.Create();74 var theList = (ListContainer)_theBuilder.Create(); 70 75 theList.ListOfStrings[0].ShouldBe("hello"); 71 76 } … … 73 78 public void indexer_value_is_ignored_when_surrogate_is_an_intermediary() 74 79 { 75 var instance = new ReflectionBasedTypeSystem().FromClr(typeof(House)).CreateBuilder();80 var instance = _ts.FromClr(typeof(House)).CreateBuilder(); 76 81 77 82 instance.GetProperty("Customers:4.FirstName").TrySetValue("Anakin"); … … 83 88 void GivenTypeInstance() 84 89 { 85 _theBuilder = new ReflectionBasedTypeSystem().FromClr(typeof(ListContainer)).CreateBuilder();90 _theBuilder = _ts.FromClr(typeof(ListContainer)).CreateBuilder(); 86 91 } 87 92 … … 93 98 public class when_using_surrogated_property : instance_context 94 99 { 95 100 96 101 } 97 102 public class when_using_DateTime_surrogate : instance_context … … 102 107 public void nested_surrogate_types_are_used_for_read_only_properties() 103 108 { 104 GivenTypeInstance<Customer>();105 GivenProperty("DateOfBirth.Day", 14);106 GivenProperty("DateOfBirth.Month", 12);107 108 WhenCreatingTheObject();109 110 ThenTheObject<Customer>().DateOfBirth.Day.ShouldBe(14);111 ThenTheObject<Customer>().DateOfBirth.Month.ShouldBe(12);109 given_builder_for<Customer>(); 110 given_property("DateOfBirth.Day", 14); 111 given_property("DateOfBirth.Month", 12); 112 113 when_creating_object(); 114 115 result_as<Customer>().DateOfBirth.Day.ShouldBe(14); 116 result_as<Customer>().DateOfBirth.Month.ShouldBe(12); 112 117 } 113 118 … … 115 120 public void surrogate_types_are_used_for_read_only_properties() 116 121 { 117 GivenTypeInstance<DateTime>(); 118 GivenProperty("Day", 14); 119 120 WhenCreatingTheObject(); 121 122 ThenTheObject<DateTime>().Day.ShouldBe(14); 123 } 124 125 T ThenTheObject<T>() 126 { 127 return (T) _result; 128 } 129 130 void WhenCreatingTheObject() 131 { 132 _result = ThenTypeBuilder.Create(); 122 given_builder_for<DateTime>(); 123 given_property("Day", 14); 124 125 when_creating_object(); 126 127 result_as<DateTime>().Day.ShouldBe(14); 128 } 129 130 T result_as<T>() 131 { 132 return (T)_result; 133 } 134 135 void when_creating_object() 136 { 137 _result = TypeBuilder.Create(); 138 } 139 140 } 141 public class indexer_for_enumerates : context.indexer_context<IEnumerable<string>,string> 142 { 143 [Test] 144 public void values_are_generated() 145 { 146 given_builder(); 147 given_successful_property(":0", "zero"); 148 given_successful_property(":1", "one"); 149 given_successful_property(":3", "three"); 150 151 when_object_built(); 152 153 then_values_should_be("zero","one","three"); 154 } 155 } 156 157 public class collection_for_enumerates : context.indexer_context<ICollection<string>, string> 158 { 159 [Test] 160 public void values_are_generated() 161 { 162 given_builder(); 163 given_successful_property(":0", "zero"); 164 given_successful_property(":1", "one"); 165 given_successful_property(":3", "three"); 166 167 when_object_built(); 168 169 then_values_should_be("zero", "one", "three"); 170 } 171 } 172 173 public class list_for_enumerates : context.indexer_context<IList<string>, string> 174 { 175 [Test] 176 public void values_are_generated() 177 { 178 given_builder(); 179 given_successful_property(":0", "zero"); 180 given_successful_property(":1", "one"); 181 given_successful_property(":3", "three"); 182 183 when_object_built(); 184 185 then_values_should_be("zero", "one", "three"); 186 } 187 } 188 public class Replicator : List<Frodo>{} 189 public class using_enumerable_types_with_indexer_surrogates : context.indexer_context<Replicator,Frodo> 190 { 191 public void multiple_values_are_added_to_the_same_object() 192 { 193 given_builder(); 194 given_successful_property(":0.FirstName", "Frodo"); 195 given_successful_property(":0.LastName", "Baggins"); 196 197 when_object_built(); 198 199 result.First().FirstName.ShouldBe("Frodo"); 200 result.First().LastName.ShouldBe("Baggins"); 201 } 202 } 203 namespace context 204 { 205 public class indexer_context<T,TValue> : OpenRasta.Testing.context 206 where T:IEnumerable<TValue> 207 { 208 protected static ITypeSystem TypeSystem = TypeSystems.Default; 209 protected ITypeBuilder builder; 210 protected T result; 211 212 protected void given_builder() 213 { 214 builder = TypeSystem.FromClr<T>().CreateBuilder(); 215 } 216 protected void given_successful_property(string key, object value) 217 { 218 builder.GetProperty(key).TrySetValue(value).ShouldBeTrue(); 219 } 220 protected void when_object_built() 221 { 222 result = (T)builder.Create(); 223 } 224 protected void then_values_should_be(params object[] values) 225 { 226 for (int i = 0; i < values.Length; i++) 227 { 228 result.Skip(i).FirstOrDefault().ShouldBe(values[i]); 229 } 230 } 133 231 } 134 232 } -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Web/Handlers/HandlerRepository_Specification.cs
r362 r425 15 15 public void canoot_add_the_same_handler_type_twice_to_the_same_key() 16 16 { 17 var type = new ReflectionBasedTypeSystem().FromClr(typeof(string));17 var type = TypeSystems.Default.FromClr(typeof(string)); 18 18 var repo = new HandlerRepository(); 19 19 … … 26 26 public void two_handlers_can_be_registered_for_the_same_key() 27 27 { 28 var handler1 = new ReflectionBasedTypeSystem().FromClr(typeof(Sauron));29 var handler2 = new ReflectionBasedTypeSystem().FromClr(typeof(Frodo));28 var handler1 = TypeSystems.Default.FromClr(typeof(Sauron)); 29 var handler2 = TypeSystems.Default.FromClr(typeof(Frodo)); 30 30 31 31 var repo = new HandlerRepository(); … … 40 40 public void the_first_handler_is_returned_when_two_handlers_are_registered_for_the_same_key() 41 41 { 42 var handler1 = new ReflectionBasedTypeSystem().FromClr(typeof(Sauron));43 var handler2 = new ReflectionBasedTypeSystem().FromClr(typeof(Frodo));42 var handler1 = TypeSystems.Default.FromClr(typeof(Sauron)); 43 var handler2 = TypeSystems.Default.FromClr(typeof(Frodo)); 44 44 45 45 var repo = new HandlerRepository(); … … 55 55 var repo = new HandlerRepository(); 56 56 57 Executing(() => repo.AddResourceHandler(null, new ReflectionBasedTypeSystem().FromClr(typeof(Frodo))))57 Executing(() => repo.AddResourceHandler(null, TypeSystems.Default.FromClr(typeof(Frodo)))) 58 58 .ShouldThrow<ArgumentNullException>(); 59 59 … … 63 63 var repo = new HandlerRepository(); 64 64 65 Executing(() => repo.AddResourceHandler(null, new ReflectionBasedTypeSystem().FromClr(typeof(Frodo))))65 Executing(() => repo.AddResourceHandler(null, TypeSystems.Default.FromClr(typeof(Frodo)))) 66 66 .ShouldThrow<ArgumentNullException>(); 67 67 } 68 68 public void the_same_handler_can_be_registered_for_two_resources() 69 69 { 70 var gilGalad = new ReflectionBasedTypeSystem().FromClr(typeof(GilGalad));70 var gilGalad = TypeSystems.Default.FromClr(typeof(GilGalad)); 71 71 72 72 var repo = new HandlerRepository(); … … 80 80 public void enumerating_over_the_list_of_handlers_will_only_return_distinct_handlers() 81 81 { 82 var gilGalad = new ReflectionBasedTypeSystem().FromClr(typeof(GilGalad));82 var gilGalad = TypeSystems.Default.FromClr(typeof(GilGalad)); 83 83 84 84 var repo = new HandlerRepository(); -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Web/Markup/SelectElement_Specification.cs
r323 r425 20 20 namespace SelectElement_Specification 21 21 { 22 public class when_the re_is_a_value: markup_element_context<ISelectElement>22 public class when_the_property_returns_a_value_for_enumerations : markup_element_context<ISelectElement> 23 23 { 24 public AttributeTargets PropertyReturningFalse { get{ return AttributeTargets.Interface;} } 24 public AttributeTargets PropertyReturningFalse 25 { 26 get{ return AttributeTargets.Interface; } 27 } 28 [Test] 25 29 public void the_option_element_is_selected() 26 30 { … … 33 37 } 34 38 } 35 //public class when_setting_a_value_before_adding_option_elements : context 36 //{ 37 // [Test] 38 // public void the_value_is_stored() 39 // { 40 // var element = new SelectElement(); 41 // element.Value = "25"; 42 // element.Children.Add(new OptionElement {Content = "26"}); 43 // element.Value.ShouldBe("25"); 44 // } 45 // [Test] 46 // public void the_selected_property_is_set_on_the_option_element() 47 // { 48 // var element = new SelectElement(); 49 // element.Value = "25"; 50 // element.Children.Add(new OptionElement {Content = "25"}); 51 // element.Children.First().Selected.ShouldBe(true); 52 // } 53 // [Test] 54 // public void the_selected_property_on_the_option_element_is_reset_if_the_assigned_value_is_different() 55 // { 39 public class when_building_an_option_tag : context 40 { 41 [Test] 42 public void the_markup_for_selected_options_is_correct() 43 { 44 var element = Document.CreateElement<IOptionElement>().Value("value")["content"]; 45 element.Selected = true; 46 element.ToString().ShouldBe("<option value=\"value\" selected=\"selected\">content</option>"); 47 } 48 [Test] 49 public void the_markup_for_not_selected_options_is_correct() 50 { 56 51 57 // var element = new SelectElement(); 58 // element.Value = "25"; 59 // element.Children.Add(new OptionElement { Content = "26", Selected = true }); 60 // element.Children.First().Selected.ShouldBe(false); 61 // } 62 // [Test] 63 // public void rendering_the_element_when_the_value_doesnt_match_an_option_results_in_an_error() 64 // { 65 // var element = new SelectElement() {Value = "24"}; 66 // element.Children.Add(new OptionElement {Content = "25"}); 67 // Executing(() => element.ToString()) 68 // .ShouldThrow<InvalidOperationException>(); 69 // } 70 //} 71 //public class when_setting_a_value_after_adding_option_elements : context 72 //{ 73 // [Test] 74 // public void the_value_is_stored() 75 // { 76 // var element = new SelectElement(); 77 // element.Children.Add(new OptionElement { Content = "26" }); 78 // element.Value = "25"; 79 // element.Value.ShouldBe("25"); 80 // } 81 // [Test] 82 // public void the_selected_property_is_set_on_the_option_element() 83 // { 84 85 // var element = new SelectElement(); 86 // element.Children.Add(new OptionElement { Content = "25" }); 87 // element.Value = "25"; 88 // element.Children.First().Selected.ShouldBe(true); 89 // } 90 // [Test] 91 // public void the_value_is_stored_after_removing_an_option_element() 92 // { 93 // var element = new SelectElement(); 94 // element.Children.Add(new OptionElement { Content = "25" }); 95 // element.Value = "25"; 96 97 // element.Children.RemoveAt(0); 98 // element.Value.ShouldBe("25"); 99 // } 100 //} 52 var element = Document.CreateElement<IOptionElement>().Value("value")["content"]; 53 element.Selected = false; 54 element.ToString().ShouldBe("<option value=\"value\">content</option>"); 55 } 56 } 101 57 } 102 58 -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Web/Pipeline/Contributors/ResponseEntityWriter_Specification.cs
r362 r425 94 94 Context.PipelineData.ResponseCodec = CodecRegistration.FromResourceType(typeof(object), 95 95 typeof(TCodec), 96 new ReflectionBasedTypeSystem(),96 TypeSystems.Default, 97 97 new MediaType("application/unknown"), 98 98 null, -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Web/TemplatedUriResolver_Specification.cs
r416 r425 19 19 using OpenRasta.Tests.Unit.Fakes; 20 20 using OpenRasta.TypeSystem; 21 using OpenRasta.TypeSystem.ReflectionBased; 21 22 using OpenRasta.Web; 22 23 … … 33 34 when_matching_uri("https://localhost/Valinor/Olorin"); 34 35 35 matching_result36 var resourceKey = matching_result 36 37 .ShouldNotBeNull() 37 .ResourceKey.ShouldBeOfType<IType>() 38 .ResourceKey; 39 resourceKey.ShouldBeOfType<IType>() 38 40 .Equals<Gandalf>().ShouldBeTrue(); 39 41 } … … 55 57 when_creating_uri<IConvertible>("location2", null); 56 58 57 ThenTheResult.ShouldBe("http://localhost/location2");59 Result.ShouldBe("http://localhost/location2"); 58 60 } 59 61 … … 67 69 when_creating_uri<object>(new NameValueCollection { { "variable1", "injected1" } }); 68 70 69 ThenTheResult.ToString().ShouldBe("http://localhost/test/injected1");71 Result.ToString().ShouldBe("http://localhost/test/injected1"); 70 72 } 71 73 … … 77 79 when_creating_uri<IList<object>>(new NameValueCollection { { "variable1", "injected1" } }); 78 80 79 ThenTheResult.ToString().ShouldBe("http://localhost/test/injected1");81 Result.ToString().ShouldBe("http://localhost/test/injected1"); 80 82 } 81 83 … … 90 92 when_creating_uri<IList<object>>(new NameValueCollection { { "variable1", "injected1" } }); 91 93 92 ThenTheResult.ToString().ShouldBe("http://localhost/test?query=injected1");94 Result.ToString().ShouldBe("http://localhost/test?query=injected1"); 93 95 } 94 96 … … 101 103 when_creating_uri<IConvertible>(null); 102 104 103 ThenTheResult.ShouldBe("http://localhost/location1");105 Result.ShouldBe("http://localhost/location1"); 104 106 } 105 107 … … 112 114 when_creating_uri<Frodo>(null); 113 115 114 ThenTheResult.ShouldBe("http://localhost/theshire");116 Result.ShouldBe("http://localhost/theshire"); 115 117 } 116 118 [Test] … … 121 123 when_creating_uri<Frodo>("http://localhost/lotr/".ToUri(), null); 122 124 123 ThenTheResult.ShouldBe("http://localhost/lotr/theshire");125 Result.ShouldBe("http://localhost/lotr/theshire"); 124 126 } 125 127 … … 131 133 when_creating_uri<Frodo>("http://localhost/lotr".ToUri(), null); 132 134 133 ThenTheResult.ShouldBe("http://localhost/lotr/theshire");135 Result.ShouldBe("http://localhost/lotr/theshire"); 134 136 } 135 137 } … … 141 143 protected TemplatedUriResolver Resolver; 142 144 143 protected Uri ThenTheResult; 145 protected Uri Result; 146 ITypeSystem TypeSystem; 144 147 148 public templated_uri_resolver_context() 149 { 150 TypeSystem = TypeSystems.Default; 151 } 145 152 [SetUp] 146 153 public void before_each_behavior() 147 154 { 148 ThenTheResult = null;155 Result = null; 149 156 Resolver = new TemplatedUriResolver(); 150 157 } 151 158 protected void when_creating_uri<T>(Uri baseUri, NameValueCollection templateParameters) 152 159 { 153 ThenTheResult = Resolver.CreateUriFor(baseUri, typeof(T), templateParameters);160 Result = Resolver.CreateUriFor(baseUri, typeof(T), templateParameters); 154 161 } 155 162 156 163 protected void given_uri_mapping(string uri, Type type, CultureInfo cultureInfo, string alias) 157 164 { 158 Resolver.Add(new UriRegistration(uri, type, alias, cultureInfo));165 Resolver.Add(new UriRegistration(uri, TypeSystem.FromClr(type), alias, cultureInfo)); 159 166 } 160 167 161 168 protected void when_creating_uri<T1>(NameValueCollection nameValueCollection) 162 169 { 163 ThenTheResult = Resolver.CreateUriFor(new Uri("http://localhost"), typeof(T1), nameValueCollection);170 Result = Resolver.CreateUriFor(new Uri("http://localhost"), typeof(T1), nameValueCollection); 164 171 } 165 172 166 173 protected void when_creating_uri<T1>(string uriName, NameValueCollection nameValueCollection) 167 174 { 168 ThenTheResult = Resolver.CreateUriFor(new Uri("http://localhost"), typeof(T1), uriName, nameValueCollection);175 Result = Resolver.CreateUriFor(new Uri("http://localhost"), typeof(T1), uriName, nameValueCollection); 169 176 } 170 177 } -
branches/2.0.3000/src/core/OpenRasta.Tests.Unit/openrasta_context.cs
r406 r425 27 27 public openrasta_context() 28 28 { 29 TypeSystem = new ReflectionBasedTypeSystem();29 TypeSystem = TypeSystems.Default; 30 30 } 31 31 … … 145 145 { 146 146 var bytes = Encoding.UTF8.GetBytes(content); 147 Request.Entity = new HttpEntity( new HttpHeaderDictionary(), new MemoryStream(bytes)) { ContentLength = bytes.Length };147 Request.Entity = new HttpEntity(Request.Entity.Headers, new MemoryStream(bytes)) { ContentLength = bytes.Length }; 148 148 } 149 149 … … 207 207 Resolver.AddDependency<IAuthenticationProvider, InMemAuthenticationProvider>(); 208 208 Resolver.AddDependencyInstance(typeof(IErrorCollector), Errors = new TestErrorCollector()); 209 Resolver.AddDependency<IPathManager, PathManager>(); 209 210 210 211 manager.SetupCommunicationContext(Context = new InMemoryCommunicationContext()); -
branches/2.0.3000/src/core/OpenRasta/Binding/BinderBaseAttribute.cs
r314 r425 10 10 11 11 using System; 12 using OpenRasta.TypeSystem;13 12 14 13 namespace OpenRasta.Binding 15 14 { 16 [ AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]17 public abstract class BinderBaseAttribute : Attribute, IObjectBinderLocator15 [Obsolete("The type was renamed. Please use BinderAttribute instead.")] 16 public abstract class BinderBaseAttribute : BinderAttribute 18 17 { 19 public abstract IObjectBinder GetBinder(IMember parameterInfo);20 18 } 21 19 } -
branches/2.0.3000/src/core/OpenRasta/Binding/BindingResult.cs
r314 r425 11 11 namespace OpenRasta.Binding 12 12 { 13 /// <summary> 14 /// Represents the result of a binding. 15 /// </summary> 13 16 public class BindingResult 14 17 { … … 20 23 } 21 24 25 /// <summary> 26 /// Gets the instance of the built object. 27 /// </summary> 28 /// <remarks> 29 /// The value of this property is undefined when the binding has not been successful. 30 /// </remarks> 22 31 public object Instance { get; private set; } 32 33 /// <summary> 34 /// Gets a value defining if the binding was successful. 35 /// </summary> 23 36 public bool Successful { get; private set; } 24 37 38 /// <summary> 39 /// Creates a binding result for failing bindings. 40 /// </summary> 41 /// <returns></returns> 25 42 public static BindingResult Failure() 26 43 { … … 28 45 } 29 46 47 /// <summary> 48 /// Creates a binding result for successful bindings. 49 /// </summary> 50 /// <param name="instance">The object successful built by the binder.</param> 51 /// <returns>An instance of the <see cref="BindingResult"/> type.</returns> 30 52 public static BindingResult Success(object instance) 31 53 { -
branches/2.0.3000/src/core/OpenRasta/Binding/ChangeSetBinder.cs
r348 r425 15 15 namespace OpenRasta.Binding 16 16 { 17 /// <summary> 18 /// Represents a binder for the ChangeSet type. 19 /// </summary> 20 /// <typeparam name="T"></typeparam> 17 21 public class ChangeSetBinder<T> : KeyedValuesBinder where T : class 18 22 { 19 23 /// <summary> 20 /// Constructs a new binder for types of type ChangeSet.24 /// Constructs a new binder for types of type <see cref="ChangeSet"/>. 21 25 /// </summary> 22 26 /// <param name="type"></param> -
branches/2.0.3000/src/core/OpenRasta/Binding/DefaultObjectBinderLocator.cs
r362 r425 22 22 { 23 23 Logger = NullLogger.Instance; 24 TypeSystem = new ReflectionBasedTypeSystem();24 TypeSystem = TypeSystems.Default; 25 25 } 26 26 … … 30 30 public IObjectBinder GetBinder(IMember member) 31 31 { 32 BinderBaseAttribute binderAttribute = member.FindAttribute<BinderBaseAttribute>() ?? member.Type.FindAttribute<BinderBaseAttribute>();32 var abstractObjectBinderAttribute = member.FindAttribute<BinderAttribute>() ?? member.Type.FindAttribute<BinderAttribute>(); 33 33 34 if ( binderAttribute != null)35 return binderAttribute.GetBinder(member);34 if (abstractObjectBinderAttribute != null) 35 return abstractObjectBinderAttribute.GetBinder(member); 36 36 37 37 IMethod binderMethod = member.GetMethod("GetBinder"); -
branches/2.0.3000/src/core/OpenRasta/Binding/IObjectBinder.cs
r314 r425 13 13 namespace OpenRasta.Binding 14 14 { 15 /// <summary> 16 /// Represents a component able to build instances of objects from object paths and values. 17 /// </summary> 15 18 public interface IObjectBinder 16 19 { 20 /// <summary> 21 /// Gets a value defining if the binder contains any values. 22 /// </summary> 17 23 bool IsEmpty { get; } 24 25 /// <summary> 26 /// Gets the list of prefixes that the binder will ignore when parsing the keys and value pairs. 27 /// </summary> 18 28 ICollection<string> Prefixes { get; } 29 30 /// <summary> 31 /// Tries to set a property value based on a key and a list of values. 32 /// </summary> 33 /// <typeparam name="TValue">The type of values being used to assign to the destination property.</typeparam> 34 /// <param name="key">The object path to the property to assign.</param> 35 /// <param name="values">The values to be used in realizing the value for the property</param> 36 /// <param name="converter">The converter responsible for converting between the source values and the destination value.</param> 37 /// <returns><c>true</c> if the assignment was successful, otherwise <c>false</c>.</returns> 19 38 bool SetProperty<TValue>(string key, IEnumerable<TValue> values, ValueConverter<TValue> converter); 39 40 /// <summary> 41 /// Tries to set an instance as the object used when assigning values. 42 /// </summary> 43 /// <param name="builtInstance">The instance of an object being used for binding.</param> 44 /// <returns><c>true</c> if the assignment was successful, otherwise <c>false</c>.</returns> 20 45 bool SetInstance(object builtInstance); 46 47 /// <summary> 48 /// Attempts to build an object and return a <see cref="BindingResult"/> instance containing the result of the building. 49 /// </summary> 50 /// <returns>An instance of the <see cref="BindingResult"/> type containing the result of the binding.</returns> 21 51 BindingResult BuildObject(); 22 52 } -
branches/2.0.3000/src/core/OpenRasta/Binding/IObjectBinderLocator.cs
r314 r425 13 13 namespace OpenRasta.Binding 14 14 { 15 /// <summary> 16 /// Defines a component able to locate an object binder for a member. 17 /// </summary> 15 18 public interface IObjectBinderLocator 16 19 { 20 /// <summary> 21 /// Gets a binder for a member. 22 /// </summary> 23 /// <param name="member">The member for which to find a binder.</param> 24 /// <returns>An instance of an <see cref="IObjectBinder"/> defined for this member.</returns> 17 25 IObjectBinder GetBinder(IMember member); 18 26 } -
branches/2.0.3000/src/core/OpenRasta/Binding/KeyedValues.cs
r315 r425 1 1 namespace OpenRasta.Binding 2 2 { 3 /// <summary> 4 /// Represents a key and associated values. 5 /// </summary> 3 6 public abstract class KeyedValues 4 7 { 8 /// <summary> 9 /// The key for which a value is provided. 10 /// </summary> 5 11 public string Key { get; protected set; } 12 13 /// <summary> 14 /// Sets a value defining if the KeyedValue was used during the binding process. 15 /// </summary> 6 16 public bool WasUsed { get; protected set; } 17 18 /// <summary> 19 /// Tries to set the value on the provided object binder. 20 /// </summary> 21 /// <param name="binder">The <see cref="IObjectBinder"/> to use when applying the value.</param> 22 /// <returns><c>true</c> if the assignment was successful, otherwise <c>false</c>.</returns> 7 23 public abstract bool SetProperty(IObjectBinder binder); 8 24 } -
branches/2.0.3000/src/core/OpenRasta/Binding/KeyedValuesBinder.cs
r360 r425 11 11 using System; 12 12 using System.Collections.Generic; 13 using System.Linq;14 13 using OpenRasta.TypeSystem; 15 using OpenRasta.TypeSystem.ReflectionBased;16 14 17 15 namespace OpenRasta.Binding … … 19 17 public class KeyedValuesBinder : IObjectBinder 20 18 { 19 readonly bool _isEnumerable; 21 20 readonly string _name; 22 21 readonly string _typeName; … … 24 23 object _cachedBuiltObject; 25 24 bool _isInstanceConstructed; 26 bool _isEnumerable;27 25 28 26 public KeyedValuesBinder(IType target) : this(target, target.Name) … … 32 30 public KeyedValuesBinder(IType target, string name) 33 31 { 34 TypeSystem = target.TypeSystem; 35 _isEnumerable = !target.Equals<string>() && target.Type.IsCollection; 32 _isEnumerable = !target.Equals<string>() && target.Type.IsEnumerable; 36 33 Builder = target.CreateBuilder(); 37 34 _name = name; … … 42 39 } 43 40 44 protected IPathManager PathManager { get; set; }45 46 41 public bool IsEmpty 47 42 { 48 get { return ! _isEnumerable && !Builder.HasValue; }43 get { return !Builder.HasValue; }
