本文整理汇总了C#中Rhino.Mocks.MockRepository.Unordered方法的典型用法代码示例。如果您正苦于以下问题:C# MockRepository.Unordered方法的具体用法?C# MockRepository.Unordered怎么用?C# MockRepository.Unordered使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rhino.Mocks.MockRepository
的用法示例。
在下文中一共展示了MockRepository.Unordered方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IProviderMethodsPassThroughAdapter
public void IProviderMethodsPassThroughAdapter()
{
MockRepository mocks = new MockRepository();
IRasterProvider adapted = mocks.CreateMock<IRasterProvider>();
ICoordinateTransformation transformStub =
MockRepository.GenerateStub<ICoordinateTransformation>();
Expression queryStub =
MockRepository.GenerateStub<Expression>();
Object objectStub =
MockRepository.GenerateStub<Object>();
IExtents extentsStub =
MockRepository.GenerateStub<IExtents>();
ICoordinateSystem coordinateSystemStub =
MockRepository.GenerateStub<ICoordinateSystem>();
using (mocks.Unordered())
{
adapted.Close();
Expect.Call(adapted.ConnectionId)
.Return("connectionid");
adapted.CoordinateTransformation = transformStub;
Expect.Call(adapted.CoordinateTransformation)
.Return(transformStub);
Expect.Call(adapted.ExecuteQuery(queryStub))
.Return(objectStub);
Expect.Call(adapted.GetExtents())
.Return(extentsStub);
Expect.Call(adapted.IsOpen)
.Return(true);
adapted.Open();
Expect.Call(adapted.SpatialReference)
.Return(coordinateSystemStub);
//adapted.Srid = 1;
Expect.Call(adapted.Srid)
.Return("2");
}
mocks.ReplayAll();
AsyncRasterProviderAdapter adapter = new AsyncRasterProviderAdapter(adapted);
adapter.Close();
Assert.Equal("connectionid", adapter.ConnectionId);
adapter.CoordinateTransformation = transformStub;
Assert.Same(transformStub, adapter.CoordinateTransformation);
Assert.Same(objectStub, adapter.ExecuteQuery(queryStub));
Assert.Same(extentsStub, adapter.GetExtents());
Assert.True(adapter.IsOpen);
adapter.Open();
Assert.Same(coordinateSystemStub, adapter.SpatialReference);
//adapter.Srid = 1;
Assert.Equal("2", adapter.Srid);
mocks.VerifyAll();
}
示例2: HttpRequestResponse_Construction_With_Non_Timeout_Stream_When_Specifying_Timeout_Test
public void HttpRequestResponse_Construction_With_Non_Timeout_Stream_When_Specifying_Timeout_Test()
{
MockRepository mocks = new MockRepository();
Stream s = mocks.CreateMock<Stream>();
using(mocks.Unordered()) {
Expect.Call(s.CanTimeout).Return(false);
}
mocks.ReplayAll();
HttpRequestResponse httpRequestResponse = new HttpRequestResponse(s, null, null, 400);
}
示例3: FlushResponse_Is_Not_Final_Test
public void FlushResponse_Is_Not_Final_Test()
{
MockRepository mocks = new MockRepository();
IAspNetRuntime aspNetRuntime = mocks.CreateMock<IAspNetRuntime>();
ITransaction transaction = mocks.CreateMock<ITransaction>();
IResponse response = mocks.CreateMock<IResponse>();
IRequest request = mocks.CreateMock<IRequest>();
using (mocks.Unordered()) {
Expect.Call(request.RawUrl).Return("/test/").Repeat.Any();
Expect.Call(transaction.Request).Return(request).Repeat.Any();
Expect.Call(transaction.Response).Return(response).Repeat.Any();
Expect.Call(delegate { aspNetRuntime.ProcessRequest(null); }).IgnoreArguments();
Expect.Call(delegate { response.Flush(); }).IgnoreArguments();
}
mocks.ReplayAll();
AspNetWorker aspNetWorker = new AspNetWorker(aspNetRuntime, "/", @"c:\temp");
aspNetWorker.ProcessTransaction(transaction);
aspNetWorker.FlushResponse(false);
}
示例4: IFeatureProviderMethodsPassThroughAdapter
public void IFeatureProviderMethodsPassThroughAdapter()
{
MockRepository mocks = new MockRepository();
IFeatureProvider adapted = mocks.CreateMock<IFeatureProvider>();
IGeometryFactory iGeometryFactoryStub =
MockRepository.GenerateStub<IGeometryFactory>();
FeatureDataTable featureDataTableStub =
MockRepository.GenerateStub<FeatureDataTable>(iGeometryFactoryStub);
IFeatureDataReader iFeatureDataReaderStub =
MockRepository.GenerateStub<IFeatureDataReader>();
IExtents iExtentsStub =
MockRepository.GenerateStub<IExtents>();
FeatureQueryExpression featureQueryExpressionStub =
MockRepository.GenerateStub<FeatureQueryExpression>(iExtentsStub, SpatialOperation.Intersects);
FeatureQueryExecutionOptions featureQueryExecutionOptionsStub =
new FeatureQueryExecutionOptions();
DataTable dataTableStub =
MockRepository.GenerateStub<DataTable>();
CultureInfo cultureInfoStub =
MockRepository.GenerateStub<CultureInfo>(1);
using (mocks.Unordered())
{
Expect.Call(adapted.CreateNewTable())
.Return(featureDataTableStub);
Expect.Call(adapted.ExecuteFeatureQuery(featureQueryExpressionStub, featureQueryExecutionOptionsStub))
.Return(iFeatureDataReaderStub);
Expect.Call(adapted.ExecuteFeatureQuery(featureQueryExpressionStub))
.Return(iFeatureDataReaderStub);
adapted.GeometryFactory = iGeometryFactoryStub;
Expect.Call(adapted.GeometryFactory)
.Return(iGeometryFactoryStub);
Expect.Call(adapted.GetFeatureCount())
.Return(3);
Expect.Call(adapted.GetSchemaTable())
.Return(dataTableStub);
Expect.Call(adapted.Locale)
.Return(cultureInfoStub);
adapted.SetTableSchema(featureDataTableStub);
}
mocks.ReplayAll();
AsyncFeatureProviderAdapter adapter = new AsyncFeatureProviderAdapter(adapted);
Assert.Same(featureDataTableStub, adapter.CreateNewTable());
Assert.Same(iFeatureDataReaderStub,
adapter.ExecuteFeatureQuery(featureQueryExpressionStub, featureQueryExecutionOptionsStub));
Assert.Same(iFeatureDataReaderStub,
adapter.ExecuteFeatureQuery(featureQueryExpressionStub));
adapter.GeometryFactory = iGeometryFactoryStub;
Assert.Same(iGeometryFactoryStub, adapter.GeometryFactory);
Assert.Equal(3, adapter.GetFeatureCount());
Assert.Same(dataTableStub, adapter.GetSchemaTable());
Assert.Same(cultureInfoStub, adapter.Locale);
adapter.SetTableSchema(featureDataTableStub);
mocks.VerifyAll();
}
示例5: EndExecuteQueryThrowsTerminatingException
public void EndExecuteQueryThrowsTerminatingException()
{
MockRepository mocks = new MockRepository();
IRasterProvider adapted = mocks.CreateMock<IRasterProvider>();
IExtents iExtentsStub =
MockRepository.GenerateStub<IExtents>();
RasterQueryExpression RasterQueryExpressionStub =
MockRepository.GenerateStub<RasterQueryExpression>(iExtentsStub, SpatialOperation.Intersects);
using (mocks.Unordered())
{
Expect.Call(adapted.ExecuteRasterQuery(RasterQueryExpressionStub))
.Do(new ExecuteQueryDelegate(executeQueryExceptionMock));
}
mocks.ReplayAll();
AsyncRasterProviderAdapter adapter = new AsyncRasterProviderAdapter(adapted);
IAsyncResult ar = adapter.BeginExecuteQuery(RasterQueryExpressionStub, null);
Assert.NotNull(ar);
Assert.Throws<InvalidOperationException>(delegate { adapter.EndExecuteQuery(ar); });
}
示例6: BeginExecuteQueryBlockUntilDone
public void BeginExecuteQueryBlockUntilDone()
{
MockRepository mocks = new MockRepository();
IRasterProvider adapted = mocks.CreateMock<IRasterProvider>();
IExtents iExtentsStub =
MockRepository.GenerateStub<IExtents>();
RasterQueryExpression RasterQueryExpressionStub =
MockRepository.GenerateStub<RasterQueryExpression>(iExtentsStub, SpatialOperation.Intersects);
_returnStreamStub = MockRepository.GenerateStub<Stream>();
_sleepInterval = 750;
using (mocks.Unordered())
{
Expect.Call(adapted.ExecuteRasterQuery(RasterQueryExpressionStub))
.Do(new ExecuteQueryDelegate(executeQueryMock));
}
mocks.ReplayAll();
AsyncRasterProviderAdapter adapter = new AsyncRasterProviderAdapter(adapted);
IAsyncResult ar = adapter.BeginExecuteQuery(RasterQueryExpressionStub, null);
Assert.NotNull(ar);
Stopwatch timer = Stopwatch.StartNew();
Assert.Same(_returnStreamStub, adapter.EndExecuteQuery(ar));
timer.Stop();
Assert.True(ar.IsCompleted);
Assert.False(ar.CompletedSynchronously);
Assert.True(timer.ElapsedMilliseconds > 500L);
mocks.VerifyAll();
}
示例7: BeginExecuteQueryPollingNotification
public void BeginExecuteQueryPollingNotification()
{
MockRepository mocks = new MockRepository();
IRasterProvider adapted = mocks.CreateMock<IRasterProvider>();
IExtents iExtentsStub =
MockRepository.GenerateStub<IExtents>();
RasterQueryExpression RasterQueryExpressionStub =
MockRepository.GenerateStub<RasterQueryExpression>(iExtentsStub, SpatialOperation.Intersects);
_returnStreamStub = MockRepository.GenerateStub<Stream>();
_sleepInterval = 1000;
using (mocks.Unordered())
{
Expect.Call(adapted.ExecuteRasterQuery(RasterQueryExpressionStub))
.Do(new ExecuteQueryDelegate(executeQueryMock));
}
mocks.ReplayAll();
AsyncRasterProviderAdapter adapter = new AsyncRasterProviderAdapter(adapted);
IAsyncResult ar = adapter.BeginExecuteQuery(RasterQueryExpressionStub, null);
Assert.NotNull(ar);
Assert.False(ar.IsCompleted);
while (!ar.IsCompleted)
{
Thread.Sleep(350);
}
Assert.True(ar.IsCompleted);
Assert.Same(_returnStreamStub, adapter.EndExecuteQuery(ar));
mocks.VerifyAll();
}
示例8: IRasterProviderMethodsPassThroughAdapter
public void IRasterProviderMethodsPassThroughAdapter()
{
MockRepository mocks = new MockRepository();
IRasterProvider adapted = mocks.CreateMock<IRasterProvider>();
Stream streamStub =
MockRepository.GenerateStub<Stream>();
IExtents iExtentsStub =
MockRepository.GenerateStub<IExtents>();
RasterQueryExpression rasterQueryExpressionStub =
MockRepository.GenerateStub<RasterQueryExpression>(iExtentsStub, SpatialOperation.Intersects);
using (mocks.Unordered())
{
Expect.Call(adapted.ExecuteRasterQuery(rasterQueryExpressionStub))
.Return(streamStub);
}
mocks.ReplayAll();
AsyncRasterProviderAdapter adapter = new AsyncRasterProviderAdapter(adapted);
Assert.Same(streamStub, adapter.ExecuteRasterQuery(rasterQueryExpressionStub));
mocks.VerifyAll();
}
示例9: IDisposableMethodsPassThroughAdapter
public void IDisposableMethodsPassThroughAdapter()
{
MockRepository mocks = new MockRepository();
IRasterProvider adapted = mocks.CreateMock<IRasterProvider>();
using (mocks.Unordered())
{
adapted.Dispose();
}
mocks.ReplayAll();
AsyncRasterProviderAdapter adapter = new AsyncRasterProviderAdapter(adapted);
adapter.Dispose();
mocks.VerifyAll();
}
示例10: GetHttpVerbName_When_Is_Put_Test
public void GetHttpVerbName_When_Is_Put_Test()
{
MockRepository mocks = new MockRepository();
IAspNetRuntime aspNetRuntime = mocks.CreateMock<IAspNetRuntime>();
ITransaction transaction = mocks.CreateMock<ITransaction>();
IResponse response = mocks.CreateMock<IResponse>();
IRequest request = mocks.CreateMock<IRequest>();
using (mocks.Unordered()) {
Expect.Call(request.RawUrl).Return("/foo/").Repeat.Any();
Expect.Call(request.HttpMethod).Return("PUT").Repeat.Any();
Expect.Call(transaction.Request).Return(request).Repeat.Any();
Expect.Call(transaction.Response).Return(response).Repeat.Any();
Expect.Call(delegate { aspNetRuntime.ProcessRequest(null); }).IgnoreArguments();
}
mocks.ReplayAll();
AspNetWorker aspNetWorker = new AspNetWorker(aspNetRuntime, "/foo", @"c:\temp");
aspNetWorker.ProcessTransaction(transaction);
Assert.AreEqual("PUT", aspNetWorker.GetHttpVerbName());
}
示例11: MovingFundsUsingTransactions
public void MovingFundsUsingTransactions()
{
MockRepository mocks = new MockRepository();
IDatabaseManager databaseManager = mocks.StrictMock<IDatabaseManager>();
IBankAccount accountOne = mocks.StrictMock<IBankAccount>(),
accountTwo = mocks.StrictMock<IBankAccount>();
using (mocks.Ordered())
{
Expect.Call(databaseManager.BeginTransaction()).Return(databaseManager);
using (mocks.Unordered())
{
Expect.Call(accountOne.Withdraw(1000));
Expect.Call(accountTwo.Deposit(1000));
}
databaseManager.Dispose();
}
mocks.ReplayAll();
Bank bank = new Bank(databaseManager);
bank.TransferFunds(accountOne, accountTwo, 1000);
mocks.VerifyAll();
}
示例12: MakeSurePrototypeTargetIsNotNeedlesslyCreatedDuringInitialization_Unit
public void MakeSurePrototypeTargetIsNotNeedlesslyCreatedDuringInitialization_Unit()
{
GoodCommand target = new GoodCommand();
NopInterceptor advice = new NopInterceptor();
MockRepository mocks = new MockRepository();
IObjectFactory factory = (IObjectFactory) mocks.CreateMock(typeof(IObjectFactory));
ProxyFactoryObject fac = new ProxyFactoryObject();
fac.ProxyInterfaces = new string[] { typeof(ICommand).FullName };
fac.IsSingleton = false;
fac.InterceptorNames = new string[] { "advice", "prototype" };
fac.ObjectFactory = factory;
// using (mocks.Record())
{
using (mocks.Unordered())
{
Expect.Call(factory.IsSingleton("advice")).Return(true);
Expect.Call(factory.GetObject("advice")).Return(advice);
Expect.Call(factory.GetType("prototype")).Return(target.GetType());
Expect.Call(factory.GetObject("prototype")).Return(target);
}
}
mocks.ReplayAll();
// using(mocks.Playback())
{
fac.GetObject();
}
mocks.VerifyAll();
}
示例13: GetProtocol_When_Request_Is_Secure_And_Response_Is_Not_Secure_Test
public void GetProtocol_When_Request_Is_Secure_And_Response_Is_Not_Secure_Test()
{
MockRepository mocks = new MockRepository();
IAspNetRuntime aspNetRuntime = mocks.CreateMock<IAspNetRuntime>();
ITransaction transaction = mocks.CreateMock<ITransaction>();
IResponse response = mocks.CreateMock<IResponse>();
IRequest request = mocks.CreateMock<IRequest>();
using (mocks.Unordered()) {
Expect.Call(response.IsSecure).Return(false).Repeat.Any();
Expect.Call(request.IsSecure).Return(true).Repeat.Any();
Expect.Call(request.RawUrl).Return("/test/").Repeat.Any();
Expect.Call(transaction.Request).Return(request).Repeat.Any();
Expect.Call(transaction.Response).Return(response).Repeat.Any();
Expect.Call(delegate { aspNetRuntime.ProcessRequest(null); }).IgnoreArguments();
}
mocks.ReplayAll();
AspNetWorker aspNetWorker = new AspNetWorker(aspNetRuntime, "/", @"c:\temp");
aspNetWorker.ProcessTransaction(transaction);
Assert.AreEqual("HTTP", aspNetWorker.GetProtocol());
}
示例14: GetPreloadedEntityBody_When_No_Data_Loaded_Test
public void GetPreloadedEntityBody_When_No_Data_Loaded_Test()
{
MockRepository mocks = new MockRepository();
IAspNetRuntime aspNetRuntime = mocks.CreateMock<IAspNetRuntime>();
ITransaction transaction = mocks.CreateMock<ITransaction>();
IResponse response = mocks.CreateMock<IResponse>();
IRequest request = mocks.CreateMock<IRequest>();
byte[] postData = new byte[] { };
using (mocks.Unordered()) {
Expect.Call(request.PostData).Return(postData).Repeat.Any();
Expect.Call(request.RawUrl).Return("/test/").Repeat.Any();
Expect.Call(transaction.Request).Return(request).Repeat.Any();
Expect.Call(transaction.Response).Return(response).Repeat.Any();
Expect.Call(delegate { aspNetRuntime.ProcessRequest(null); }).IgnoreArguments();
}
mocks.ReplayAll();
AspNetWorker aspNetWorker = new AspNetWorker(aspNetRuntime, "/", @"c:\temp");
aspNetWorker.ProcessTransaction(transaction);
Assert.AreEqual(postData, aspNetWorker.GetPreloadedEntityBody());
}
示例15: GetPathInfo_With_Tail_Test
public void GetPathInfo_With_Tail_Test()
{
MockRepository mocks = new MockRepository();
IAspNetRuntime aspNetRuntime = mocks.CreateMock<IAspNetRuntime>();
ITransaction transaction = mocks.CreateMock<ITransaction>();
IResponse response = mocks.CreateMock<IResponse>();
IRequest request = mocks.CreateMock<IRequest>();
using (mocks.Unordered()) {
Expect.Call(request.RawUrl).Return("/foo/Page.aspx/ATail").Repeat.Any();
Expect.Call(transaction.Request).Return(request).Repeat.Any();
Expect.Call(transaction.Response).Return(response).Repeat.Any();
Expect.Call(delegate { aspNetRuntime.ProcessRequest(null); }).IgnoreArguments();
}
mocks.ReplayAll();
AspNetWorker aspNetWorker = new AspNetWorker(aspNetRuntime, "/foo", @"c:\temp");
aspNetWorker.ProcessTransaction(transaction);
Assert.AreEqual("/ATail", aspNetWorker.GetPathInfo());
}