Changeset 425

Show
Ignore:
Timestamp:
02/08/10 09:34:39 (6 months ago)
Author:
serialseb
Message:

numerous fixes to binders and new surrogate type system

Location:
branches/2.0.3000
Files:
29 added
3 removed
76 modified
4 copied
1 moved

Legend:

Unmodified
Added
Removed
  • branches/2.0.3000/reports/nunit/.xml

    r423 r425  
    11<?xml version="1.0" encoding="utf-8" standalone="no"?> 
    22<!--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"> 
    44  <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" /> 
    55  <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"> 
    77    <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"> 
    99        <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"> 
    1111            <results> 
    12               <test-case name="OpenBastard.Scenarios.accessing_the_homepage.the_homepage_can_be_retrieved_using_xml" executed="True" success="True" time="3.386" 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" /> 
    1313            </results> 
    1414          </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"> 
    1616            <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.167" asserts="1" /> 
    19               <test-case name="OpenBastard.Scenarios.manipulating_users.cannot_delete_user_with_wrong_credentials" executed="True" success="True" time="0.016" 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" /> 
    2020            </results> 
    2121          </test-suite> 
    22           <test-suite name="uploading files" executed="True" success="True" time="0.100" asserts="0"> 
     22          <test-suite name="uploading files" executed="True" success="True" time="0.124" asserts="0"> 
    2323            <results> 
    24               <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_a_complex_type" executed="True" success="True" time="0.045" 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" /> 
    2525              <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.025" asserts="10002" /> 
    27               <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_ifile" executed="True" success="True" time="0.013" asserts="10002" /> 
    28               <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_file_with_specific_content_type" executed="True" success="True" time="0.014" 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" /> 
    2929            </results> 
    3030          </test-suite> 
    3131        </results> 
    3232      </test-suite> 
    33       <test-suite name="IIS 7 - Classic Mode" executed="True" success="True" time="11.071" asserts="0"> 
     33      <test-suite name="IIS 7 - Classic Mode" executed="True" success="True" time="12.532" asserts="0"> 
    3434        <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"> 
    3636            <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" /> 
    3838            </results> 
    3939          </test-suite> 
    40           <test-suite name="manipulating users" executed="True" success="True" time="0.810" asserts="0"> 
     40          <test-suite name="manipulating users" executed="True" success="True" time="0.836" asserts="0"> 
    4141            <results> 
    42               <test-case name="OpenBastard.Scenarios.manipulating_users.can_create_a_user" executed="True" success="True" time="0.739" asserts="4" /> 
    43               <test-case name="OpenBastard.Scenarios.manipulating_users.can_delete_user_with_correct_credentials" executed="True" success="True" time="0.063" asserts="1" /> 
    44               <test-case name="OpenBastard.Scenarios.manipulating_users.cannot_delete_user_with_wrong_credentials" executed="True" success="True" time="0.007" 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" /> 
    4545            </results> 
    4646          </test-suite> 
    47           <test-suite name="uploading files" executed="True" success="True" time="0.114" asserts="0"> 
     47          <test-suite name="uploading files" executed="True" success="True" time="0.185" asserts="0"> 
    4848            <results> 
    49               <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_a_complex_type" executed="True" success="True" time="0.040" 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" /> 
    5050              <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.024" asserts="10002" /> 
    52               <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_ifile" executed="True" success="True" time="0.029" asserts="10002" /> 
    53               <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_file_with_specific_content_type" executed="True" success="True" time="0.018" 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" /> 
    5454            </results> 
    5555          </test-suite> 
    5656        </results> 
    5757      </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"> 
    5959        <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"> 
    6161            <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" /> 
    6363            </results> 
    6464          </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"> 
    6666            <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.062" 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" /> 
    7070            </results> 
    7171          </test-suite> 
    72           <test-suite name="uploading files" executed="True" success="True" time="0.151" asserts="0"> 
     72          <test-suite name="uploading files" executed="True" success="True" time="0.182" asserts="0"> 
    7373            <results> 
    74               <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_a_complex_type" executed="True" success="True" time="0.074" 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.002" asserts="0" /> 
    76               <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_enumerable_multipart" executed="True" success="True" time="0.026" asserts="10002" /> 
    77               <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_ifile" executed="True" success="True" time="0.030" asserts="10002" /> 
    78               <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_file_with_specific_content_type" executed="True" success="True" time="0.018" 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" /> 
    7979            </results> 
    8080          </test-suite> 
    8181        </results> 
    8282      </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"> 
    8484        <results> 
    85           <test-suite name="accessing the homepage" executed="True" success="True" time="0.012" asserts="0"> 
     85          <test-suite name="accessing the homepage" executed="True" success="True" time="0.017" asserts="0"> 
    8686            <results> 
    87               <test-case name="OpenBastard.Scenarios.accessing_the_homepage.the_homepage_can_be_retrieved_using_xml" executed="True" success="True" time="0.011" 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" /> 
    8888            </results> 
    8989          </test-suite> 
    90           <test-suite name="manipulating users" executed="True" success="True" time="0.013" asserts="0"> 
     90          <test-suite name="manipulating users" executed="True" success="True" time="0.028" asserts="0"> 
    9191            <results> 
    92               <test-case name="OpenBastard.Scenarios.manipulating_users.can_create_a_user" executed="True" success="True" time="0.006" asserts="4" /> 
    93               <test-case name="OpenBastard.Scenarios.manipulating_users.can_delete_user_with_correct_credentials" executed="True" success="True" time="0.003" asserts="1" /> 
    94               <test-case name="OpenBastard.Scenarios.manipulating_users.cannot_delete_user_with_wrong_credentials" executed="True" success="True" time="0.002" 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" /> 
    9595            </results> 
    9696          </test-suite> 
    97           <test-suite name="uploading files" executed="True" success="True" time="0.047" asserts="0"> 
     97          <test-suite name="uploading files" executed="True" success="True" time="0.068" asserts="0"> 
    9898            <results> 
    99               <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_a_complex_type" executed="True" success="True" time="0.010" 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" /> 
    100100              <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.012" asserts="10002" /> 
    102               <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_a_file_as_an_ifile" executed="True" success="True" time="0.012" asserts="10002" /> 
    103               <test-case name="OpenBastard.Scenarios.uploading_files.can_upload_file_with_specific_content_type" executed="True" success="True" time="0.011" 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" /> 
    104104            </results> 
    105105          </test-suite> 
  • branches/2.0.3000/src/core/OpenRasta.Net35/Web/Markup/ExpressionTreeXhtmlExtensions.cs

    r323 r425  
    5757        public static ISelectElement Select(this IXhtmlAnchor hook, Expression<Func<object>> propertyName, IEnumerable<string> options) 
    5858        { 
    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()); 
    6060        } 
    6161        public static ISelectElement Select(this IXhtmlAnchor hook, Expression<Func<object>> propertyName, IDictionary<string, string> options) 
    6262        { 
    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()); 
    6464        } 
    6565        public static ISelectElement Select(this IXhtmlAnchor hook, Expression<Func<object>> propertyName, IEnumerable<IOptionElement> options) 
    6666        { 
    6767            var et = new PropertyPathForInstance<object>(propertyName); 
     68 
     69 
    6870            var select = Document.CreateElement<ISelectElement>().Name(et.FullPath); 
    6971            //TODOD: Special case multiple values  
     
    123125        { 
    124126            return Select<T>(hook, propertyName, 
    125                               options.Select(val => Document.CreateElement<IOptionElement>()[val])); 
     127                              options.Select(val => Document.CreateElement<IOptionElement>()[val]).ToList()); 
    126128        } 
    127129 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Integration/Binding/CustomSurrogates.cs

    r423 r425  
    1 using System.Net; 
     1using System; 
     2using System.Net; 
    23using System.Text; 
     4using DigestAuthentication_Specification; 
    35using NUnit.Framework; 
    46using OpenRasta.Configuration; 
     
    810using OpenRasta.Testing; 
    911using OpenRasta.Tests.Integration; 
     12using OpenRasta.TypeSystem; 
     13using OpenRasta.TypeSystem.Surrogates; 
     14using OpenRasta.TypeSystem.Surrogates.Static; 
    1015using OpenRasta.Web; 
    1116 
    12 namespace DigestAuthentication_Specification 
     17namespace Dynamic_surrogates 
    1318{ 
    14     public class when_using_the_correct_credentials : context.http_digest_context 
     19    public class adding_custom_surrogate : context.surrogates_context 
    1520    { 
    1621 
    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() 
    1924        { 
    20             given_request("GET", "/protected"); 
     25            given_request("GET", "/customer/3"); 
    2126 
    2227            when_reading_response(); 
    2328 
    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); 
    4529        } 
    4630    } 
    47     public class when_using_incorrect_credentials : context.http_digest_context 
     31 
     32    public class MySurrogate : AbstractStaticSurrogate<Customer> 
    4833    { 
    49         [Test] 
    50         public void a_request_for_a_protected_resource_fails_with_401_response() 
     34        public int Id 
    5135        { 
    52             given_client_credentials("username", "wrongpassword"); 
    53             given_request("GET", "/home"); 
     36            get { return 0; } 
     37            set{throw new InvalidOperationException();} 
     38        } 
     39    } 
    5440 
    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     } 
    7541    namespace context 
    7642    { 
    77         public class http_digest_context : server_context 
     43        public abstract class surrogates_context : server_context 
    7844        { 
    7945 
    80             public http_digest_context() 
     46            public surrogates_context() 
    8147        { 
    8248            ConfigureServer(() => 
     
    8652 
    8753                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); 
    9158            }); 
    9259        } 
    9360        } 
    9461    } 
    95     public class FakeAuthProvider : IAuthenticationProvider 
     62     
     63    public class Handler 
    9664    { 
    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) 
    10766        { 
    10867            return new OperationResult.OK(); 
    10968        } 
    11069 
    111         [HttpOperation(ForUriName = "unprotected")] 
    112         public OperationResult Get() 
    113         { 
    114             return new OperationResult.OK(); 
    115         } 
    11670    } 
    11771} 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Integration/OpenRasta.Tests.Integration.csproj

    r406 r425  
    6363      <Link>Properties\CommonInfo.cs</Link> 
    6464    </Compile> 
     65    <Compile Include="Binding\CustomSurrogates.cs" /> 
    6566    <Compile Include="Regressions\92.cs" /> 
    6667    <Compile Include="Codecs\HtmlForm_Specification.cs" /> 
     
    9899    </ProjectReference> 
    99100  </ItemGroup> 
    100   <ItemGroup> 
    101     <Folder Include="Binding\" /> 
    102   </ItemGroup> 
    103101  <Import Project="..\..\..\build\defaults.targets" /> 
    104102  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Binding/DefaultBinderLocator_Specification.cs

    r314 r425  
    1818        public void the_binder_is_created_correctly() 
    1919        { 
    20             var type = new ReflectionBasedTypeSystem().FromClr(typeof(ClassWithStaticBinder)); 
     20            var type = TypeSystems.Default.FromClr(typeof(ClassWithStaticBinder)); 
    2121            var binderLocator = new DefaultObjectBinderLocator(); 
    2222 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Binding/KeyedValuesBinder_Specification.cs

    r359 r425  
    121121            customer.Orders[2].IsSelected.ShouldBeFalse(); 
    122122        } 
     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        } 
    123138        protected IType TypeOf<T>() 
    124139        { 
    125             return new ReflectionBasedTypeSystem().FromClr(typeof(T)); 
     140            return TypeSystems.Default.FromClr(typeof(T)); 
    126141        } 
    127142    } 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Codecs/ApplicationXWwwUrlformEncodedCodec_Specification.cs

    r369 r425  
    161161                    .ShouldBe("John"); 
    162162            customer.LastName 
    163                     .ShouldBe("Doe"); 
     163                      .ShouldBe("Doe"); 
    164164 
    165165            customer.DateOfBirth.Day 
    166166                    .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); 
    167178        } 
    168179 
     
    183194        public string FirstName { get; set; } 
    184195        public string LastName { get; set; } 
     196        public IEnumerable<string> Attributes { get; set; } 
    185197        public DateTime DateOfBirth { get; set; } 
    186198        public Address Address { get; set; } 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Codecs/CodecMatch_Specification.cs

    r314 r425  
    6969                    new CodecRegistration( 
    7070                        typeof (string),  
    71                         new ReflectionBasedTypeSystem().FromClr(typeof (object)), new MediaType(mediaType)), score, matchingParameters); 
     71                        TypeSystems.Default.FromClr(typeof (object)), new MediaType(mediaType)), score, matchingParameters); 
    7272        } 
    7373    } 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Codecs/CodecRepository_Specification.cs

    r348 r425  
    152152    public class when_searching_for_content_type_writers_for_a_media_type : codec_repository_context 
    153153    { 
    154         readonly ITypeSystem typeSystem = new ReflectionBasedTypeSystem(); 
     154        readonly ITypeSystem typeSystem = TypeSystems.Default; 
    155155        new IList<CodecRegistration> ThenTheResult; 
    156156 
     
    264264        public CodecRegistration ThenTheResult; 
    265265        public CodecMatch ThenTheResultScoring; 
    266         public ITypeSystem TypeSystem = new ReflectionBasedTypeSystem(); 
     266        public ITypeSystem TypeSystem = TypeSystems.Default; 
    267267 
    268268        [SetUp] 
     
    286286                Codecs.Add(CodecRegistration.FromResourceType(resourceType, 
    287287                                                         typeof(TCodec), 
    288                                                          new ReflectionBasedTypeSystem(), 
     288                                                         TypeSystems.Default, 
    289289                                                         mediaType, 
    290290                                                         null, 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Codecs/MultipartFormDataCodec_Specification.cs

    r348 r425  
    302302                                                    DependencyManager.Codecs, 
    303303                                                    DependencyManager.GetService<IDependencyResolver>(), 
    304                                                     new ReflectionBasedTypeSystem(), 
     304                                                    TypeSystems.Default, 
    305305                                                    new DefaultObjectBinderLocator()); 
    306306        } 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Codecs/media_type_reader_context.cs

    r369 r425  
    7979            var codec = codecInstance as IMediaTypeReader; 
    8080            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); 
    8282            else 
    8383            { 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Configuration/LegacyManualConfiguration_Specification.cs

    r362 r425  
    3333            match.ShouldNotBeNull(); 
    3434            match.UriCulture.ShouldBe(language); 
    35             match.ResourceKey.ShouldBe(new ReflectionBasedTypeSystem().FromClr(typeof(TResource))); 
     35            match.ResourceKey.ShouldBe(TypeSystems.Default.FromClr(typeof(TResource))); 
    3636            match.UriName.ShouldBe(name); 
    3737        } 
     
    7777        { 
    7878            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). 
    8080                    Distinct().SingleOrDefault(); 
    8181        } 
     
    179179            var handlerMatch = DependencyManager.Handlers.GetHandlerTypesFor(urimatch.ResourceKey).FirstOrDefault(); 
    180180            handlerMatch.ShouldNotBeNull(); 
    181             handlerMatch.ShouldBe(new ReflectionBasedTypeSystem().FromClr(typeof(THandler))); 
     181            handlerMatch.ShouldBe(TypeSystems.Default.FromClr(typeof(THandler))); 
    182182            return handlerMatch; 
    183183        } 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Configuration/MetaModelHandler_Specification.cs

    r362 r425  
    136136 
    137137            Handler.Process(MetaModel); 
    138             var typeSystem = new ReflectionBasedTypeSystem().FromClr(typeof(Customer)); 
     138            var typeSystem = TypeSystems.Default.FromClr(typeof(Customer)); 
    139139            var registeredHandlers = HandlerRepository.GetHandlerTypesFor(typeSystem); 
    140140 
     
    146146        void given_handler_registration() 
    147147        { 
    148             var typeSystem = new ReflectionBasedTypeSystem(); 
     148            var typeSystem = TypeSystems.Default; 
    149149            MetaModel.ResourceRegistrations.Add(new ResourceModel 
    150150            { 
     
    160160    public class when_registering_non_IType_resource_keys : metamodelhandler_context<TypeRewriterMetaModelHandler> 
    161161    { 
    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; 
    168168            Handler = new TypeRewriterMetaModelHandler(TypeSystem); 
    169169        } 
     
    238238        void given_unknown_type_registered_as_codec() 
    239239        { 
    240             var typeSystem = new ReflectionBasedTypeSystem(); 
     240            var typeSystem = TypeSystems.Default; 
    241241            MetaModel.ResourceRegistrations.Add(new ResourceModel 
    242242            { 
     
    251251        void given_codec_registration() 
    252252        { 
    253             var typeSystem = new ReflectionBasedTypeSystem(); 
     253            var typeSystem = TypeSystems.Default; 
    254254            MetaModel.ResourceRegistrations.Add(new ResourceModel 
    255255            { 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Configuration/MetaModel_Specification.cs

    r406 r425  
    8989        public void a_resource_with_IType_is_registered() 
    9090        { 
    91             ResourceSpaceHas.ResourcesOfType(new ReflectionBasedTypeSystem().FromClr(typeof(Customer))); 
     91            ResourceSpaceHas.ResourcesOfType(TypeSystems.Default.FromClr(typeof(Customer))); 
    9292 
    9393            MetaModel.ResourceRegistrations[0].ResourceKey.ShouldBeOfType<IType>().Name.ShouldBe("Customer"); 
     
    209209        { 
    210210            ResourceSpaceHas.ResourcesOfType(typeof(Frodo)).AtUri("/theshrine") 
    211                 .HandledBy(new ReflectionBasedTypeSystem().FromClr(typeof(CustomerHandler))); 
     211                .HandledBy(TypeSystems.Default.FromClr(typeof(CustomerHandler))); 
    212212            FirstRegistration.Handlers[0].Name.ShouldBe("CustomerHandler"); 
    213213        } 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Fakes/Customer.cs

    r300 r425  
    2525    { 
    2626        public List<Order> Orders { get; set; } 
     27        public ICollection<string> Attributes { get; set; } 
    2728    } 
    2829 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/OpenRasta.Tests.Unit.csproj

    r406 r425  
    116116    <Compile Include="TypeSystem\PropertyPathManager_Specification.cs" /> 
    117117    <Compile Include="TypeSystem\ReflectionExtensions_Specification.cs" /> 
     118    <Compile Include="TypeSystem\Surrogate2_Specification.cs" /> 
    118119    <Compile Include="TypeSystem\Surrogates_Specification.cs" /> 
    119120    <Compile Include="Text\Rfc2047Encoding_Specification.cs" /> 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/OperationModel/CodecSelectors/RequestCodecSelector_Specification.cs

    r317 r425  
    44using System.Runtime.InteropServices; 
    55using NUnit.Framework; 
     6using OpenRasta.Binding; 
    67using OpenRasta.Codecs; 
    78using OpenRasta.OperationModel; 
     
    910using OpenRasta.OperationModel.Hydrators; 
    1011using OpenRasta.Testing; 
     12using OpenRasta.Tests.Unit.Fakes; 
    1113using OpenRasta.Tests.Unit.OperationModel.Filters; 
    1214using OpenRasta.Web; 
     
    7678            FilteredOperations.First(x => x.Name == "Get").GetRequestCodec().ShouldBeNull();    
    7779        } 
     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        } 
    78107    } 
    79108    public class when_a_codec_is_not_found : requestcodecselector_context 
     
    117146        } 
    118147        public void GetWithOptionalValue([Optional]int optionalIndex){} 
     148 
     149        public void GetFrodo(Frodo frodo) 
     150        { 
     151             
     152        } 
    119153    } 
    120154} 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/TypeSystem/Instances_Specification.cs

    r314 r425  
    1616using OpenRasta.Testing; 
    1717using OpenRasta.Tests.Unit.Fakes; 
     18using OpenRasta.Tests.Unit.TypeSystem; 
    1819using OpenRasta.TypeSystem; 
    1920using OpenRasta.TypeSystem.ReflectionBased; 
     21using Frodo=OpenRasta.Tests.Unit.Fakes.Frodo; 
    2022 
    2123namespace Instances_Specification 
     
    2628        public void cannot_assign_properties_to_a_null_object() 
    2729        { 
    28             GivenTypeInstance<Customer>(); 
    29  
    30             Executing(() => ThenTypeBuilder.Apply(null)).ShouldThrow<ArgumentNullException>(); 
     30            given_builder_for<Customer>(); 
     31 
     32            Executing(() => TypeBuilder.Update(null)).ShouldThrow<ArgumentNullException>(); 
    3133        } 
    3234 
     
    3436        public void the_properties_are_assigned() 
    3537        { 
    36             GivenTypeInstance<Customer>(); 
    37             GivenProperty("username", "johndoe"); 
     38            given_builder_for<Customer>(); 
     39            given_property("username", "johndoe"); 
    3840 
    3941            var newCustomer = new Customer {FirstName = "John"}; 
    4042 
    41             ThenTypeBuilder.Apply(newCustomer); 
     43            TypeBuilder.Update(newCustomer); 
    4244 
    4345            newCustomer.Username.ShouldBe("johndoe"); 
    4446            newCustomer.FirstName.ShouldBe("John"); 
    4547 
    46             GivenProperty("lastname", "doe"); 
     48            given_property("lastname", "doe"); 
    4749            newCustomer = new Customer {FirstName = "John"}; 
    48             ThenTypeBuilder.Apply(newCustomer); 
     50            TypeBuilder.Update(newCustomer); 
    4951 
    5052            newCustomer.Username.ShouldBe("johndoe"); 
     
    5961        public void a_property_retrieved_twice_retrieves_the_same_object() 
    6062        { 
    61             GivenTypeInstance<string>(); 
    62  
    63             ThenTypeBuilder.GetProperty("Length").ShouldBeTheSameInstanceAs(ThenTypeBuilder.GetProperty("Length")); 
     63            given_builder_for<string>(); 
     64 
     65            TypeBuilder.GetProperty("Length").ShouldBeTheSameInstanceAs(TypeBuilder.GetProperty("Length")); 
    6466        } 
    6567 
     
    6769        public void a_readonly_property_is_returned_as_non_writable() 
    6870        { 
    69             GivenTypeInstance<string>(); 
    70  
    71             ThenTypeBuilder.GetProperty("Length").CanWrite.ShouldBeFalse(); 
     71            given_builder_for<string>(); 
     72 
     73            TypeBuilder.GetProperty("Length").CanWrite.ShouldBeFalse(); 
    7274        } 
    7375 
     
    7577        public void an_unknown_property_returns_null() 
    7678        { 
    77             GivenTypeInstance<string>(); 
    78  
    79             ThenTypeBuilder.GetProperty("unknown").ShouldBeNull(); 
     79            given_builder_for<string>(); 
     80 
     81            TypeBuilder.GetProperty("unknown").ShouldBeNull(); 
    8082        } 
    8183    } 
     
    8688        public void a_property_retrieved_but_wihtout_a_value_is_not_present_in_the_changes() 
    8789        { 
    88             GivenTypeInstance<Customer>(); 
    89  
    90             ThenTypeBuilder.GetProperty("FirstName") 
     90            given_builder_for<Customer>(); 
     91 
     92            TypeBuilder.GetProperty("FirstName") 
    9193                .TrySetValue(2).ShouldBeFalse(); 
    9294 
    93             ThenTypeBuilder.Changes.Count.ShouldBe(0); 
     95            TypeBuilder.Changes.Count.ShouldBe(0); 
    9496        } 
    9597 
     
    9799        public void a_successfully_assigned_property_is_present_in_the_list_of_changes() 
    98100        { 
    99             GivenTypeInstance<Customer>(); 
    100  
    101             ThenTypeBuilder.GetProperty("FirstName").TrySetValue("Frodo"); 
    102  
    103             ThenTypeBuilder.Changes.Count.ShouldBe(1); 
    104             ThenTypeBuilder.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(); 
    105107        } 
    106108 
     
    108110        public void accessing_the_indexer_with_an_unknown_key_throws() 
    109111        { 
    110             GivenTypeInstance<Customer>(); 
    111             Executing(() => { IPropertyBuilder value = ThenTypeBuilder.Changes["firstname"]; }) 
     112            given_builder_for<Customer>(); 
     113            Executing(() => { IPropertyBuilder value = TypeBuilder.Changes["firstname"]; }) 
    112114                .ShouldThrow<ArgumentOutOfRangeException>(); 
    113115        } 
     
    116118        public void the_change_list_is_readonly() 
    117119        { 
    118             GivenTypeInstance<Customer>(); 
    119  
    120             ThenTypeBuilder.Changes.IsReadOnly.ShouldBeTrue(); 
    121             Executing(() => ThenTypeBuilder.Changes.Add(null, null)) 
     120            given_builder_for<Customer>(); 
     121 
     122            TypeBuilder.Changes.IsReadOnly.ShouldBeTrue(); 
     123            Executing(() => TypeBuilder.Changes.Add(null, null)) 
    122124                .ShouldThrow<NotSupportedException>(); 
    123125 
    124             Executing(() => ThenTypeBuilder.Changes.Remove(null)) 
     126            Executing(() => TypeBuilder.Changes.Remove(null)) 
    125127                .ShouldThrow<NotSupportedException>(); 
    126128 
    127             Executing(() => ThenTypeBuilder.Changes["bla"] = null) 
     129            Executing(() => TypeBuilder.Changes["bla"] = null) 
    128130                .ShouldThrow<NotSupportedException>(); 
    129131        } 
     
    132134        public void the_keys_are_case_insensitive() 
    133135        { 
    134             GivenTypeInstance<Customer>(); 
    135             ThenTypeBuilder.GetProperty("FirstName") 
     136            given_builder_for<Customer>(); 
     137            TypeBuilder.GetProperty("FirstName") 
    136138                .TrySetValue("Frodo"); 
    137             ThenTypeBuilder.Changes["firstname"].Value.ShouldBe("Frodo"); 
     139            TypeBuilder.Changes["firstname"].Value.ShouldBe("Frodo"); 
    138140        } 
    139141    } 
     
    144146        public void a_property_is_not_set_when_the_type_is_incompatible() 
    145147        { 
    146             GivenTypeInstance<Customer>(); 
    147  
    148             ThenTypeBuilder.GetProperty("Username").TrySetValue(3).ShouldBeFalse(); 
     148            given_builder_for<Customer>(); 
     149 
     150            TypeBuilder.GetProperty("Username").TrySetValue(3).ShouldBeFalse(); 
    149151        } 
    150152 
     
    152154        public void a_writable_property_is_set_and_its_value_can_be_retrieved() 
    153155        { 
    154             GivenTypeInstance<Customer>(); 
    155  
    156             ThenTypeBuilder.GetProperty("Username").TrySetValue("hello") 
     156            given_builder_for<Customer>(); 
     157 
     158            TypeBuilder.GetProperty("Username").TrySetValue("hello") 
    157159                .ShouldBeTrue(); 
    158160 
    159             ThenTypeBuilder.GetProperty("Username") 
     161            TypeBuilder.GetProperty("Username") 
    160162                .Value.ShouldBe("hello"); 
    161163        } 
     
    172174        public void a_new_instance_is_created_when_using_create() 
    173175        { 
    174             GivenTypeInstance<Customer>(); 
    175             Customer customer = ThenTypeBuilder.Create().ShouldBeOfType<Customer>().ShouldNotBeNull(); 
    176  
    177             ThenTypeBuilder.GetProperty("FirstName").TrySetValue("Frodo") 
     176            given_builder_for<Customer>(); 
     177            Customer customer = TypeBuilder.Create().ShouldBeOfType<Customer>().ShouldNotBeNull(); 
     178 
     179            TypeBuilder.GetProperty("FirstName").TrySetValue("Frodo") 
    178180                .ShouldBeTrue(); 
    179181 
    180182            customer.LastName = "Baggins"; 
    181             customer = ThenTypeBuilder.Create() as Customer; 
     183            customer = TypeBuilder.Create() as Customer; 
    182184 
    183185            customer.FirstName.ShouldBe("Frodo"); 
     
    188190        public void assigning_properties_after_the_property_got_assigned_a_parent_updates_the_parent() 
    189191        { 
    190             GivenTypeInstance<Customer>(); 
     192            given_builder_for<Customer>(); 
     193 
    191194            var customerInstance = new Customer(); 
    192             ThenTypeBuilder.TrySetValue(customerInstance); 
    193  
    194             IPropertyBuilder firstName = ThenTypeBuilder.GetProperty("FirstName"); 
    195             firstName.SetOwner(ThenTypeBuilder); 
     195            TypeBuilder.TrySetValue(customerInstance); 
     196 
     197            IPropertyBuilder firstName = TypeBuilder.GetProperty("FirstName"); 
     198            //firstName.SetOwner(TypeBuilder); 
    196199 
    197200            firstName.TrySetValue(new[] {"Smeagol"}, IdentityConverter); 
    198201 
     202            TypeBuilder.Update(customerInstance); 
    199203            customerInstance.FirstName.ShouldBe("Smeagol"); 
    200204        } 
    201205 
    202206        [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] 
    221207        public void no_reference_is_kept_after_a_call_to_apply() 
    222208        { 
    223             GivenTypeInstance<Customer>(); 
     209            given_builder_for<Customer>(); 
    224210            var customer = new Customer(); 
    225             ThenTypeBuilder.Apply(customer); 
    226  
    227             ThenTypeBuilder.GetProperty("FirstName").TrySetValue("Frodo") 
     211            TypeBuilder.Update(customer); 
     212 
     213            TypeBuilder.GetProperty("FirstName").TrySetValue("Frodo") 
    228214                .ShouldBeTrue(); 
    229215 
    230             object newCustomer = ThenTypeBuilder.Create(); 
     216            object newCustomer = TypeBuilder.Create(); 
    231217            newCustomer.ShouldNotBeTheSameInstanceAs(customer); 
    232218            customer.FirstName.ShouldBe(null); 
     
    245231        void WhenCreatingTheObject() 
    246232        { 
    247             _result = ThenTypeBuilder.Create(); 
     233            _result = TypeBuilder.Create(); 
    248234        } 
    249235 
     
    251237        public void a_type_instance_can_be_applied_twice() 
    252238        { 
    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"); 
    259245            WhenCreatingTheObject(); 
    260246 
     
    266252        public void a_value_can_be_assigned_to_the_type_instance() 
    267253        { 
    268             GivenTypeInstance<int>(); 
    269  
    270             ThenTypeBuilder.TrySetValue(3) 
     254            given_builder_for<int>(); 
     255 
     256            TypeBuilder.TrySetValue(3) 
    271257                .ShouldBeTrue(); 
    272             ThenTypeBuilder.HasValue.ShouldBeTrue(); 
    273             ThenTypeBuilder.Value.ShouldBe(3); 
     258            TypeBuilder.HasValue.ShouldBeTrue(); 
     259            TypeBuilder.Value.ShouldBe(3); 
    274260        } 
    275261 
     
    277263        public void a_value_of_the_incorrect_type_cannot_be_assinged() 
    278264        { 
    279             GivenTypeInstance<int>(); 
    280  
    281             ThenTypeBuilder.TrySetValue("hello") 
     265            given_builder_for<int>(); 
     266 
     267            TypeBuilder.TrySetValue("hello") 
    282268                .ShouldBeFalse(); 
    283269 
    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        } 
    294272        [Test] 
    295273        public void nested_properties_are_assigned() 
    296274        { 
    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"); 
    300278 
    301279            WhenCreatingTheObject(); 
     
    308286        public void setting_properties_on_children_of_indexers_works_as_expected() 
    309287        { 
    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"); 
    314292            WhenCreatingTheObject(); 
    315293            ThenTheObject<House>().CustomersByName["john"].FirstName.ShouldBe("John"); 
     
    320298        public void the_properties_are_assigned() 
    321299        { 
    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"); 
    325303 
    326304            WhenCreatingTheObject(); 
     
    330308    } 
    331309 
    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        } 
    389317        // ITypeSystem _typeSystem = new  
    390         public void GivenTypeInstance<T1>() 
    391         { 
    392             ThenTypeBuilder = new ReflectionBasedTypeSystem().FromClr(typeof(T1)).CreateBuilder(); 
    393         } 
    394  
    395         protected ITypeBuilder ThenTypeBuilder; 
    396  
    397         protected void GivenProperty(string prop, object value) 
    398         { 
    399             ThenTypeBuilder.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(); 
    400328        } 
    401329    } 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/TypeSystem/Members_Specification.cs

    r362 r425  
    2020using OpenRasta.TypeSystem; 
    2121using OpenRasta.TypeSystem.ReflectionBased; 
    22 using OpenRasta.TypeSystem.ReflectionBased.Surrogates; 
    2322 
    2423namespace Accessors_Specification 
     
    2928        public void a_reference_type_can_be_assigned_a_null_value() 
    3029        { 
    31             new ReflectionBasedType(typeof(string)).CanSetValue(null) 
     30            new ReflectionBasedType(_typeSystem,typeof(string)).CanSetValue(null) 
    3231                .ShouldBe(true); 
    3332        } 
     
    3635        public void a_reflection_type_cannot_be_equal_to_null() 
    3736        { 
    38             new ReflectionBasedType(typeof(string)).Equals(null) 
     37            new ReflectionBasedType(_typeSystem,typeof(string)).Equals(null) 
    3938                .ShouldBeFalse(); 
    4039        } 
     
    4443        { 
    4544            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) 
    4746                .ShouldBeTrue(); 
    4847            result.ShouldBe("value"); 
     
    5352        { 
    5453            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) 
    5655                .ShouldBeFalse(); 
    5756        } 
     
    6059        public void a_value_type_cannot_be_assigned_a_null_value() 
    6160        { 
    62             new ReflectionBasedType(typeof(int)).CanSetValue(null) 
     61            new ReflectionBasedType(_typeSystem,typeof(int)).CanSetValue(null) 
    6362                .ShouldBeFalse(); 
    6463        } 
     
    6766        public void an_incorrect_type_cannot_be_assigned() 
    6867        { 
    69             new ReflectionBasedType(typeof(int)).CanSetValue("hello") 
     68            new ReflectionBasedType(_typeSystem,typeof(int)).CanSetValue("hello") 
    7069                .ShouldBeFalse(); 
    7170        } 
     
    8180        public void the_name_is_the_type_name() 
    8281        { 
    83             new ReflectionBasedType(typeof(string)).Name 
     82            new ReflectionBasedType(_typeSystem,typeof(string)).Name 
    8483                .ShouldBe("String"); 
    8584        } 
     
    8887        public void two_reflection_based_types_are_equal_if_built_from_the_same_native_type() 
    8988        { 
    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)); 
    9291            type1.Equals(type2).ShouldBeTrue(); 
    9392            type1.GetHashCode().ShouldBe(type2.GetHashCode()); 
     
    9796        public void two_reflection_based_types_are_not_equal_if_built_from_different_native_types() 
    9897        { 
    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)); 
    101100            type1.Equals(type2).ShouldBeFalse(); 
    102101            type1.GetHashCode().ShouldNotBe(type2.GetHashCode()); 
     
    109108        public void a_type_compared_to_a_null_results_in_minus_one() 
    110109        { 
    111             new ReflectionBasedType(typeof(int)).CompareTo(null) 
     110            new ReflectionBasedType(_typeSystem,typeof(int)).CompareTo(null) 
    112111                .ShouldBe(-1); 
    113112        } 
     
    116115        public void two_types_not_in_an_inheritance_hierarchy_compare_to_minus_one() 
    117116        { 
    118             new ReflectionBasedType(typeof(int)).CompareTo(new ReflectionBasedType(typeof(string))) 
     117            new ReflectionBasedType(_typeSystem,typeof(int)).CompareTo(new ReflectionBasedType(_typeSystem,typeof(string))) 
    119118                .ShouldBe(-1); 
    120119        } 
     
    144143        { 
    145144            GivenTypeFor<Type>(); 
    146             ThenTheProperty("Namespace.Length").TargetType.ShouldBe<int>(); 
     145            ThenTheProperty("Namespace.Length").Type.Equals<int>().ShouldBeTrue(); 
    147146        } 
    148147 
     
    152151            GivenTypeFor<string>(); 
    153152 
    154             ThenTheProperty("Length").TargetType.ShouldBe<int>(); 
     153            ThenTheProperty("Length").Type.Equals<int>().ShouldBeTrue(); 
    155154        } 
    156155 
     
    159158        { 
    160159            GivenTypeFor<House>(); 
    161             ThenTheProperty("Customers:0.FirstName").TargetType.ShouldBe<string>(); 
     160            ThenTheProperty("Customers:0.FirstName").Type.Equals<string>().ShouldBeTrue(); 
    162161        } 
    163162 
     
    180179        { 
    181180            GivenTypeFor<House>(); 
    182             ThenTheProperty("Customers:0").TargetType.ShouldBe<Customer>(); 
     181            ThenTheProperty("Customers:0").Type.Equals<Customer>().ShouldBeTrue(); 
    183182        } 
    184183 
     
    232231        } 
    233232 
    234         ReflectionBasedProperty ThenTheProperty(string propertyName) 
    235         { 
    236             return ThenTheType.GetProperty(propertyName) as ReflectionBasedProperty; 
     233        IProperty ThenTheProperty(string propertyName) 
     234        { 
     235            return Type.FindPropertyByPath(propertyName); 
    237236        } 
    238237    } 
     
    257256            GivenTypeFor<RingOfPower>(); 
    258257 
    259             var wornByMethod = ThenTheType.GetMethod("WornBy"); 
     258            var wornByMethod = Type.GetMethod("WornBy"); 
    260259            wornByMethod 
    261260                .ShouldNotBeNull() 
     
    271270            GivenTypeFor<RingOfPower>(); 
    272271 
    273             ThenTheType.GetMethod("WornBy") 
    274                 .ShouldBeTheSameInstanceAs(ThenTheType.GetMethod("wornby")); 
     272            Type.GetMethod("WornBy") 
     273                .ShouldBeTheSameInstanceAs(Type.GetMethod("wornby")); 
    275274        } 
    276275        [Test] 
     
    279278            GivenTypeFor<RingOfPower>(); 
    280279 
    281             ThenTheType.GetMethod("ToString").Owner.TypeName.ShouldBe("Object"); 
    282         } 
    283         protected ICollection<IMethod> TheMethods { get { return ThenTheType.GetMethods(); } } 
     280            Type.GetMethod("ToString").Owner.TypeName.ShouldBe("Object"); 
     281        } 
     282        protected ICollection<IMethod> TheMethods { get { return Type.GetMethods(); } } 
    284283    } 
    285284 
     
    292291    public class when_building_types_from_the_type_system : context 
    293292    { 
    294         readonly ITypeSystem TypeSystem = new ReflectionBasedTypeSystem(); 
     293        readonly ITypeSystem TypeSystem = TypeSystems.Default; 
    295294 
    296295        [Test] 
     
    311310    public class IType_context : context 
    312311    { 
    313         protected IType ThenTheType; 
     312         
     313        protected ITypeSystem _typeSystem; 
     314 
     315        public IType_context() 
     316        { 
     317            _typeSystem = TypeSystems.Default; 
     318        } 
     319        protected IType Type; 
    314320 
    315321        protected void GivenTypeFor<TTarget>() 
    316322        { 
    317             ThenTheType = TypeForClr<TTarget>(); 
     323            Type = TypeForClr<TTarget>(); 
    318324        } 
    319325 
    320326        protected IType TypeForClr<TTarget>() 
    321327        { 
    322             return new ReflectionBasedTypeSystem { SurrogateFactory = new DefaultSurrogateFactory() }.FromClr(typeof(TTarget)); 
     328            return _typeSystem.FromClr(typeof(TTarget)); 
    323329        } 
    324330    } 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/TypeSystem/PropertyPathManager_Specification.cs

    r359 r425  
    66using OpenRasta.Testing; 
    77using OpenRasta.TypeSystem; 
    8 using OpenRasta.TypeSystem.ReflectionBased; 
    98 
    109namespace PropertyPathManager_Specification 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/TypeSystem/Surrogates_Specification.cs

    r314 r425  
    1111 
    1212using System; 
     13using System.Collections; 
    1314using System.Collections.Generic; 
     15using System.Linq; 
    1416using Instances_Specification; 
    1517using NUnit.Framework; 
    1618using OpenRasta.Testing; 
    1719using OpenRasta.Tests.Unit.Fakes; 
     20using OpenRasta.Tests.Unit.TypeSystem; 
    1821using OpenRasta.TypeSystem; 
    1922using OpenRasta.TypeSystem.ReflectionBased; 
     23using Frodo = OpenRasta.Tests.Unit.Fakes.Frodo; 
    2024 
    2125namespace Surrogates_Specification 
    2226{ 
    23     public class when_using_ListOfT : context 
     27 
     28    public class when_using_ListOfT : instance_context 
    2429    { 
    2530        ITypeBuilder _theBuilder; 
     
    2833        public void indexer_values_are_ignored_and_values_are_appended() 
    2934        { 
    30             GivenTypeInstance(); 
     35            given_builder(); 
    3136 
    3237            _theBuilder.GetProperty(":1").TrySetValue("hello").ShouldBeTrue(); 
    3338            _theBuilder.GetProperty(":0").TrySetValue("hello2").ShouldBeTrue(); 
    3439 
    35             var theList = (List<string>) _theBuilder.Create(); 
     40            var theList = (List<string>)_theBuilder.Create(); 
    3641            theList[0].ShouldBe("hello"); 
    3742            theList[1].ShouldBe("hello2"); 
     
    4045        public void the_indexer_is_surrogated() 
    4146        { 
    42             GivenTypeInstance(); 
     47            given_builder(); 
    4348 
    4449            _theBuilder.GetProperty(":0").TrySetValue("hello") 
    4550                .ShouldBeTrue(); 
    4651 
    47             var theList = (List<string>) _theBuilder.Create(); 
     52            var theList = (List<string>)_theBuilder.Create(); 
    4853            theList[0].ShouldBe("hello"); 
    4954        } 
    5055 
    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 : context 
     56        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 
    5863    { 
    5964        ITypeBuilder _theBuilder; 
     
    6772                .ShouldBeTrue(); 
    6873 
    69             var theList = (ListContainer) _theBuilder.Create(); 
     74            var theList = (ListContainer)_theBuilder.Create(); 
    7075            theList.ListOfStrings[0].ShouldBe("hello"); 
    7176        } 
     
    7378        public void indexer_value_is_ignored_when_surrogate_is_an_intermediary() 
    7479        { 
    75             var instance = new ReflectionBasedTypeSystem().FromClr(typeof(House)).CreateBuilder(); 
     80            var instance = _ts.FromClr(typeof(House)).CreateBuilder(); 
    7681 
    7782            instance.GetProperty("Customers:4.FirstName").TrySetValue("Anakin"); 
     
    8388        void GivenTypeInstance() 
    8489        { 
    85             _theBuilder = new ReflectionBasedTypeSystem().FromClr(typeof(ListContainer)).CreateBuilder(); 
     90            _theBuilder = _ts.FromClr(typeof(ListContainer)).CreateBuilder(); 
    8691        } 
    8792 
     
    9398    public class when_using_surrogated_property : instance_context 
    9499    { 
    95          
     100 
    96101    } 
    97102    public class when_using_DateTime_surrogate : instance_context 
     
    102107        public void nested_surrogate_types_are_used_for_read_only_properties() 
    103108        { 
    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); 
    112117        } 
    113118 
     
    115120        public void surrogate_types_are_used_for_read_only_properties() 
    116121        { 
    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            } 
    133231        } 
    134232    } 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Web/Handlers/HandlerRepository_Specification.cs

    r362 r425  
    1515        public void canoot_add_the_same_handler_type_twice_to_the_same_key() 
    1616        { 
    17             var type = new ReflectionBasedTypeSystem().FromClr(typeof(string)); 
     17            var type = TypeSystems.Default.FromClr(typeof(string)); 
    1818            var repo = new HandlerRepository(); 
    1919 
     
    2626        public void two_handlers_can_be_registered_for_the_same_key() 
    2727        { 
    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)); 
    3030 
    3131            var repo = new HandlerRepository(); 
     
    4040        public void the_first_handler_is_returned_when_two_handlers_are_registered_for_the_same_key() 
    4141        { 
    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)); 
    4444 
    4545            var repo = new HandlerRepository(); 
     
    5555            var repo = new HandlerRepository(); 
    5656 
    57             Executing(() => repo.AddResourceHandler(null, new ReflectionBasedTypeSystem().FromClr(typeof(Frodo)))) 
     57            Executing(() => repo.AddResourceHandler(null, TypeSystems.Default.FromClr(typeof(Frodo)))) 
    5858                .ShouldThrow<ArgumentNullException>(); 
    5959 
     
    6363            var repo = new HandlerRepository(); 
    6464 
    65             Executing(() => repo.AddResourceHandler(null, new ReflectionBasedTypeSystem().FromClr(typeof(Frodo)))) 
     65            Executing(() => repo.AddResourceHandler(null, TypeSystems.Default.FromClr(typeof(Frodo)))) 
    6666                .ShouldThrow<ArgumentNullException>(); 
    6767        } 
    6868        public void the_same_handler_can_be_registered_for_two_resources() 
    6969        { 
    70             var gilGalad = new ReflectionBasedTypeSystem().FromClr(typeof(GilGalad)); 
     70            var gilGalad = TypeSystems.Default.FromClr(typeof(GilGalad)); 
    7171 
    7272            var repo = new HandlerRepository(); 
     
    8080        public void enumerating_over_the_list_of_handlers_will_only_return_distinct_handlers() 
    8181        { 
    82             var gilGalad = new ReflectionBasedTypeSystem().FromClr(typeof(GilGalad)); 
     82            var gilGalad = TypeSystems.Default.FromClr(typeof(GilGalad)); 
    8383 
    8484            var repo = new HandlerRepository(); 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Web/Markup/SelectElement_Specification.cs

    r323 r425  
    2020namespace SelectElement_Specification 
    2121{ 
    22     public class when_there_is_a_value : markup_element_context<ISelectElement> 
     22    public class when_the_property_returns_a_value_for_enumerations : markup_element_context<ISelectElement> 
    2323    { 
    24         public AttributeTargets PropertyReturningFalse { get{ return AttributeTargets.Interface;} } 
     24        public AttributeTargets PropertyReturningFalse 
     25        { 
     26            get{ return AttributeTargets.Interface; } 
     27        } 
     28        [Test] 
    2529        public void the_option_element_is_selected() 
    2630        { 
     
    3337        } 
    3438    } 
    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        { 
    5651 
    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    } 
    10157} 
    10258 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Web/Pipeline/Contributors/ResponseEntityWriter_Specification.cs

    r362 r425  
    9494            Context.PipelineData.ResponseCodec = CodecRegistration.FromResourceType(typeof(object), 
    9595                                                                       typeof(TCodec), 
    96                                                                        new ReflectionBasedTypeSystem(), 
     96                                                                       TypeSystems.Default, 
    9797                                                                       new MediaType("application/unknown"), 
    9898                                                                       null, 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/Web/TemplatedUriResolver_Specification.cs

    r416 r425  
    1919using OpenRasta.Tests.Unit.Fakes; 
    2020using OpenRasta.TypeSystem; 
     21using OpenRasta.TypeSystem.ReflectionBased; 
    2122using OpenRasta.Web; 
    2223 
     
    3334            when_matching_uri("https://localhost/Valinor/Olorin"); 
    3435 
    35             matching_result 
     36            var resourceKey = matching_result 
    3637                .ShouldNotBeNull() 
    37                 .ResourceKey.ShouldBeOfType<IType>() 
     38                .ResourceKey; 
     39            resourceKey.ShouldBeOfType<IType>() 
    3840                .Equals<Gandalf>().ShouldBeTrue(); 
    3941        } 
     
    5557            when_creating_uri<IConvertible>("location2", null); 
    5658 
    57             ThenTheResult.ShouldBe("http://localhost/location2"); 
     59            Result.ShouldBe("http://localhost/location2"); 
    5860        } 
    5961 
     
    6769            when_creating_uri<object>(new NameValueCollection { { "variable1", "injected1" } }); 
    6870 
    69             ThenTheResult.ToString().ShouldBe("http://localhost/test/injected1"); 
     71            Result.ToString().ShouldBe("http://localhost/test/injected1"); 
    7072        } 
    7173 
     
    7779            when_creating_uri<IList<object>>(new NameValueCollection { { "variable1", "injected1" } }); 
    7880 
    79             ThenTheResult.ToString().ShouldBe("http://localhost/test/injected1"); 
     81            Result.ToString().ShouldBe("http://localhost/test/injected1"); 
    8082        } 
    8183 
     
    9092            when_creating_uri<IList<object>>(new NameValueCollection { { "variable1", "injected1" } }); 
    9193 
    92             ThenTheResult.ToString().ShouldBe("http://localhost/test?query=injected1"); 
     94            Result.ToString().ShouldBe("http://localhost/test?query=injected1"); 
    9395        } 
    9496 
     
    101103            when_creating_uri<IConvertible>(null); 
    102104 
    103             ThenTheResult.ShouldBe("http://localhost/location1"); 
     105            Result.ShouldBe("http://localhost/location1"); 
    104106        } 
    105107 
     
    112114            when_creating_uri<Frodo>(null); 
    113115 
    114             ThenTheResult.ShouldBe("http://localhost/theshire"); 
     116            Result.ShouldBe("http://localhost/theshire"); 
    115117        } 
    116118        [Test] 
     
    121123            when_creating_uri<Frodo>("http://localhost/lotr/".ToUri(), null); 
    122124 
    123             ThenTheResult.ShouldBe("http://localhost/lotr/theshire"); 
     125            Result.ShouldBe("http://localhost/lotr/theshire"); 
    124126        } 
    125127 
     
    131133            when_creating_uri<Frodo>("http://localhost/lotr".ToUri(), null); 
    132134 
    133             ThenTheResult.ShouldBe("http://localhost/lotr/theshire"); 
     135            Result.ShouldBe("http://localhost/lotr/theshire"); 
    134136        } 
    135137    } 
     
    141143            protected TemplatedUriResolver Resolver; 
    142144 
    143             protected Uri ThenTheResult; 
     145            protected Uri Result; 
     146            ITypeSystem TypeSystem; 
    144147 
     148            public templated_uri_resolver_context() 
     149            { 
     150                TypeSystem = TypeSystems.Default; 
     151            } 
    145152            [SetUp] 
    146153            public void before_each_behavior() 
    147154            { 
    148                 ThenTheResult = null; 
     155                Result = null; 
    149156                Resolver = new TemplatedUriResolver(); 
    150157            } 
    151158            protected void when_creating_uri<T>(Uri baseUri, NameValueCollection templateParameters) 
    152159            { 
    153                 ThenTheResult = Resolver.CreateUriFor(baseUri, typeof(T), templateParameters); 
     160                Result = Resolver.CreateUriFor(baseUri, typeof(T), templateParameters); 
    154161            } 
    155162 
    156163            protected void given_uri_mapping(string uri, Type type, CultureInfo cultureInfo, string alias) 
    157164            { 
    158                 Resolver.Add(new UriRegistration(uri, type, alias, cultureInfo)); 
     165                Resolver.Add(new UriRegistration(uri,  TypeSystem.FromClr(type), alias, cultureInfo)); 
    159166            } 
    160167 
    161168            protected void when_creating_uri<T1>(NameValueCollection nameValueCollection) 
    162169            { 
    163                 ThenTheResult = Resolver.CreateUriFor(new Uri("http://localhost"), typeof(T1), nameValueCollection); 
     170                Result = Resolver.CreateUriFor(new Uri("http://localhost"), typeof(T1), nameValueCollection); 
    164171            } 
    165172 
    166173            protected void when_creating_uri<T1>(string uriName, NameValueCollection nameValueCollection) 
    167174            { 
    168                 ThenTheResult = Resolver.CreateUriFor(new Uri("http://localhost"), typeof(T1), uriName, nameValueCollection); 
     175                Result = Resolver.CreateUriFor(new Uri("http://localhost"), typeof(T1), uriName, nameValueCollection); 
    169176            } 
    170177        } 
  • branches/2.0.3000/src/core/OpenRasta.Tests.Unit/openrasta_context.cs

    r406 r425  
    2727        public openrasta_context() 
    2828        { 
    29             TypeSystem = new ReflectionBasedTypeSystem(); 
     29            TypeSystem = TypeSystems.Default; 
    3030        } 
    3131 
     
    145145        { 
    146146            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 }; 
    148148        } 
    149149 
     
    207207                Resolver.AddDependency<IAuthenticationProvider, InMemAuthenticationProvider>(); 
    208208            Resolver.AddDependencyInstance(typeof(IErrorCollector), Errors = new TestErrorCollector()); 
     209            Resolver.AddDependency<IPathManager, PathManager>(); 
    209210             
    210211            manager.SetupCommunicationContext(Context = new InMemoryCommunicationContext()); 
  • branches/2.0.3000/src/core/OpenRasta/Binding/BinderBaseAttribute.cs

    r314 r425  
    1010 
    1111using System; 
    12 using OpenRasta.TypeSystem; 
    1312 
    1413namespace OpenRasta.Binding 
    1514{ 
    16     [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] 
    17     public abstract class BinderBaseAttribute : Attribute, IObjectBinderLocator 
     15    [Obsolete("The type was renamed. Please use BinderAttribute instead.")] 
     16    public abstract class BinderBaseAttribute : BinderAttribute 
    1817    { 
    19         public abstract IObjectBinder GetBinder(IMember parameterInfo); 
    2018    } 
    2119} 
  • branches/2.0.3000/src/core/OpenRasta/Binding/BindingResult.cs

    r314 r425  
    1111namespace OpenRasta.Binding 
    1212{ 
     13    /// <summary> 
     14    /// Represents the result of a binding. 
     15    /// </summary> 
    1316    public class BindingResult 
    1417    { 
     
    2023        } 
    2124 
     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> 
    2231        public object Instance { get; private set; } 
     32 
     33        /// <summary> 
     34        /// Gets a value defining if the binding was successful. 
     35        /// </summary> 
    2336        public bool Successful { get; private set; } 
    2437 
     38        /// <summary> 
     39        /// Creates a binding result for failing bindings. 
     40        /// </summary> 
     41        /// <returns></returns> 
    2542        public static BindingResult Failure() 
    2643        { 
     
    2845        } 
    2946 
     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> 
    3052        public static BindingResult Success(object instance) 
    3153        { 
  • branches/2.0.3000/src/core/OpenRasta/Binding/ChangeSetBinder.cs

    r348 r425  
    1515namespace OpenRasta.Binding 
    1616{ 
     17    /// <summary> 
     18    /// Represents a binder for the ChangeSet type. 
     19    /// </summary> 
     20    /// <typeparam name="T"></typeparam> 
    1721    public class ChangeSetBinder<T> : KeyedValuesBinder where T : class 
    1822    { 
    1923        /// <summary> 
    20         /// Constructs a new binder for types of type ChangeSet. 
     24        /// Constructs a new binder for types of type <see cref="ChangeSet"/>. 
    2125        /// </summary> 
    2226        /// <param name="type"></param> 
  • branches/2.0.3000/src/core/OpenRasta/Binding/DefaultObjectBinderLocator.cs

    r362 r425  
    2222        { 
    2323            Logger = NullLogger.Instance; 
    24             TypeSystem = new ReflectionBasedTypeSystem(); 
     24            TypeSystem = TypeSystems.Default; 
    2525        } 
    2626 
     
    3030        public IObjectBinder GetBinder(IMember member) 
    3131        { 
    32             BinderBaseAttribute binderAttribute = member.FindAttribute<BinderBaseAttribute>() ?? member.Type.FindAttribute<BinderBaseAttribute>(); 
     32            var abstractObjectBinderAttribute = member.FindAttribute<BinderAttribute>() ?? member.Type.FindAttribute<BinderAttribute>(); 
    3333 
    34             if (binderAttribute != null) 
    35                 return binderAttribute.GetBinder(member); 
     34            if (abstractObjectBinderAttribute != null) 
     35                return abstractObjectBinderAttribute.GetBinder(member); 
    3636 
    3737            IMethod binderMethod = member.GetMethod("GetBinder"); 
  • branches/2.0.3000/src/core/OpenRasta/Binding/IObjectBinder.cs

    r314 r425  
    1313namespace OpenRasta.Binding 
    1414{ 
     15    /// <summary> 
     16    /// Represents a component able to build instances of objects from object paths and values. 
     17    /// </summary> 
    1518    public interface IObjectBinder 
    1619    { 
     20        /// <summary> 
     21        /// Gets a value defining if the binder contains any values. 
     22        /// </summary> 
    1723        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> 
    1828        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> 
    1938        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> 
    2045        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> 
    2151        BindingResult BuildObject(); 
    2252    } 
  • branches/2.0.3000/src/core/OpenRasta/Binding/IObjectBinderLocator.cs

    r314 r425  
    1313namespace OpenRasta.Binding 
    1414{ 
     15    /// <summary> 
     16    /// Defines a component able to locate an object binder for a member. 
     17    /// </summary> 
    1518    public interface IObjectBinderLocator 
    1619    { 
     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> 
    1725        IObjectBinder GetBinder(IMember member); 
    1826    } 
  • branches/2.0.3000/src/core/OpenRasta/Binding/KeyedValues.cs

    r315 r425  
    11namespace OpenRasta.Binding 
    22{ 
     3    /// <summary> 
     4    /// Represents a key and associated values. 
     5    /// </summary> 
    36    public abstract class KeyedValues 
    47    { 
     8        /// <summary> 
     9        /// The key for which a value is provided. 
     10        /// </summary> 
    511        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> 
    616        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> 
    723        public abstract bool SetProperty(IObjectBinder binder); 
    824    } 
  • branches/2.0.3000/src/core/OpenRasta/Binding/KeyedValuesBinder.cs

    r360 r425  
    1111using System; 
    1212using System.Collections.Generic; 
    13 using System.Linq; 
    1413using OpenRasta.TypeSystem; 
    15 using OpenRasta.TypeSystem.ReflectionBased; 
    1614 
    1715namespace OpenRasta.Binding 
     
    1917    public class KeyedValuesBinder : IObjectBinder 
    2018    { 
     19        readonly bool _isEnumerable; 
    2120        readonly string _name; 
    2221        readonly string _typeName; 
     
    2423        object _cachedBuiltObject; 
    2524        bool _isInstanceConstructed; 
    26         bool _isEnumerable; 
    2725 
    2826        public KeyedValuesBinder(IType target) : this(target, target.Name) 
     
    3230        public KeyedValuesBinder(IType target, string name) 
    3331        { 
    34             TypeSystem = target.TypeSystem; 
    35             _isEnumerable = !target.Equals<string>() && target.Type.IsCollection; 
     32            _isEnumerable = !target.Equals<string>() && target.Type.IsEnumerable; 
    3633            Builder = target.CreateBuilder(); 
    3734            _name = name; 
     
    4239        } 
    4340 
    44         protected IPathManager PathManager { get; set; } 
    45  
    4641        public bool IsEmpty 
    4742        { 
    48             get { return !_isEnumerable && !Builder.HasValue; } 
     43            get { return !Builder.HasValue; }