@@ -19,22 +19,22 @@ public interface IDataBuilder<out T> where T : class
1919 }
2020
2121 /// <summary>
22- /// Base class definining infrastructure for a class that generates objects of type <see cref="TEntity "/>.
22+ /// Base class definining infrastructure for a class that generates objects of type <see cref="TObject "/>.
2323 /// </summary>
24- /// <typeparam name="TEntity ">The type of object this class generates</typeparam>
24+ /// <typeparam name="TObject ">The type of object this class generates</typeparam>
2525 /// <typeparam name="TBuilder">The type for this class, yes this is a recursive type definition</typeparam>
26- public abstract class DataBuilder < TEntity , TBuilder > : IDataBuilder < TEntity >
27- where TEntity : class
28- where TBuilder : class , IDataBuilder < TEntity >
26+ public abstract class DataBuilder < TObject , TBuilder > : IDataBuilder < TObject >
27+ where TObject : class
28+ where TBuilder : class , IDataBuilder < TObject >
2929 {
3030 private readonly Dictionary < string , object > _properties = new Dictionary < string , object > ( ) ;
31- private ProxyBuilder < TEntity > _proxyBuilder ;
31+ private ProxyBuilder < TObject > _proxyBuilder ;
3232
3333 /// <summary>
3434 /// Build the object.
3535 /// </summary>
3636 /// <returns>The built object</returns>
37- public TEntity Build ( )
37+ public TObject Build ( )
3838 {
3939 if ( _proxyBuilder != null )
4040 {
@@ -50,15 +50,15 @@ public TEntity Build()
5050 /// Build the actual object
5151 /// </summary>
5252 /// <returns>The built object</returns>
53- protected abstract TEntity BuildObject ( ) ;
53+ protected abstract TObject BuildObject ( ) ;
5454
5555 /// <summary>
5656 /// Return an NSubstitute proxy object when .Build() is called rather than a real object.
5757 /// </summary>
5858 /// <returns>The builder so that other method calls can be chained</returns>
5959 public TBuilder AsProxy ( )
6060 {
61- _proxyBuilder = new ProxyBuilder < TEntity > ( _properties ) ;
61+ _proxyBuilder = new ProxyBuilder < TObject > ( _properties ) ;
6262 return this as TBuilder ;
6363 }
6464
@@ -67,26 +67,26 @@ public TBuilder AsProxy()
6767 /// This allows you to add any .Returns() values that are more complex than the public properties that are proxied by default.
6868 /// </summary>
6969 /// <param name="proxy">The proxy object</param>
70- protected virtual void AlterProxy ( TEntity proxy ) { }
70+ protected virtual void AlterProxy ( TObject proxy ) { }
7171
7272 /// <summary>
73- /// Records the given value for the given property from <see cref="TEntity "/>.
73+ /// Records the given value for the given property from <see cref="TObject "/>.
7474 /// </summary>
7575 /// <typeparam name="TValue">The type of the property</typeparam>
7676 /// <param name="property">A lambda expression specifying the property to record a value for</param>
7777 /// <param name="value">The value to record</param>
78- public void Set < TValue > ( Expression < Func < TEntity , TValue > > property , TValue value )
78+ public void Set < TValue > ( Expression < Func < TObject , TValue > > property , TValue value )
7979 {
8080 _properties [ GetPropertyName ( property ) ] = value ;
8181 }
8282
8383 /// <summary>
84- /// Gets the recorded value for the given property from <see cref="TEntity "/>.
84+ /// Gets the recorded value for the given property from <see cref="TObject "/>.
8585 /// </summary>
8686 /// <typeparam name="TValue">The type of the property</typeparam>
8787 /// <param name="property">A lambda expression specifying the property to retrieve the recorded value for</param>
8888 /// <returns>The recorded value of the property</returns>
89- public TValue Get < TValue > ( Expression < Func < TEntity , TValue > > property )
89+ public TValue Get < TValue > ( Expression < Func < TObject , TValue > > property )
9090 {
9191 if ( ! Has ( property ) )
9292 throw new ArgumentException (
@@ -101,13 +101,13 @@ public TValue Get<TValue>(Expression<Func<TEntity, TValue>> property)
101101 }
102102
103103 /// <summary>
104- /// Gets the recorded value for the given property from <see cref="TEntity "/> or if no
104+ /// Gets the recorded value for the given property from <see cref="TObject "/> or if no
105105 /// value has been recorded the default value for <see cref="TValue"/>.
106106 /// </summary>
107107 /// <typeparam name="TValue">The type of the property</typeparam>
108108 /// <param name="property">A lambda expression specifying the property to retrieve the recorded value for</param>
109109 /// <returns>The recorded value of the property or teh default value for <see cref="TValue"/> if no value recorded</returns>
110- public TValue GetOrDefault < TValue > ( Expression < Func < TEntity , TValue > > property )
110+ public TValue GetOrDefault < TValue > ( Expression < Func < TObject , TValue > > property )
111111 {
112112 return Has ( property )
113113 ? Get ( property )
@@ -126,25 +126,25 @@ public static IListBuilder<TBuilder> CreateListOfSize(int size)
126126 }
127127
128128 /// <summary>
129- /// Returns whether or not there is currently a value recorded against the given property from <see cref="TEntity "/>.
129+ /// Returns whether or not there is currently a value recorded against the given property from <see cref="TObject "/>.
130130 /// </summary>
131131 /// <typeparam name="TValue">The type of the property</typeparam>
132132 /// <param name="property">A lambda expression specifying the property to retrieve the recorded value for</param>
133133 /// <returns>Whether or not there is a recorded value for the property</returns>
134- protected bool Has < TValue > ( Expression < Func < TEntity , TValue > > property )
134+ protected bool Has < TValue > ( Expression < Func < TObject , TValue > > property )
135135 {
136136 return _properties . ContainsKey ( GetPropertyName ( property ) ) ;
137137 }
138138
139- private static string GetPropertyName < TValue > ( Expression < Func < TEntity , TValue > > property )
139+ private static string GetPropertyName < TValue > ( Expression < Func < TObject , TValue > > property )
140140 {
141141 var memExp = property . Body as MemberExpression ;
142142 if ( memExp == null )
143143 throw new ArgumentException (
144144 string . Format (
145145 "Given property expression ({0}) didn't specify a property on {1}" ,
146146 property ,
147- typeof ( TEntity ) . Name
147+ typeof ( TObject ) . Name
148148 ) ,
149149 "property"
150150 ) ;
0 commit comments