I am a newbie to Rhino

I have method written like below :

    [TestMethod]
        public void 
WhenProducitonOrderList_IsNotFromPaperlessWarehouse_POList_IsNotSent()
        {
            // arrange
            MockProductionOrders.ProductCodeInfoList = new string[]
            {
                
"5150-000002,INPA160336611,5150-000020,C,30,FR,,,,,,,,INPA,5150",
                
"5150-000001,INGA1390368811,5150-000001,C,30,FR,,,,,,,,INGA,5150"
            };

            var purchPRDListMock = 
MockProductionOrders.CreateTestProductionOrders();
            var purchPRDListRepositoryMock = 
MockRepository.GenerateMock<IProductionOrderRepository>();
            purchPRDListRepositoryMock.Expect(x => 
x.GetNewProductionOrders(Arg<DateTime>.Is.Anything)).Return(purchPRDListMock);
            var purchPRDListEnueratedMock = 
MockProductionOrders.CreateTestProductionOrder();
            var productionOrderManagerMock = 
MockRepository.GenerateMock<IProductionOrderManager>();
            productionOrderManagerMock.Expect(x => 
x.SendToWms(Arg<IEnumerable<ProductionOrderToWMS>>.Is.Anything)).Return(purchPRDListEnueratedMock);
            var purchPRDValidator = new ProductionOrderValidator();
            var purchaseOrderToWmsServiceMock = 
MockRepository.GenerateMock<PurchaseOrderToWMSPort>();
            var soapAdapterMock = 
MockRepository.GenerateMock<ISoapAdapter<PurchaseOrderToWMSPort>>();
            soapAdapterMock.Expect(x => 
x.GetService()).Return(purchaseOrderToWmsServiceMock);
            var purchPRDRequestMock = 
MockRepository.GenerateMock<PurchaseOrderToWMSOperationRequest>();
            var axToWmsPRDManager = new 
AxToWmsProdManager(purchPRDListRepositoryMock, purchPRDValidator, 
productionOrderManagerMock, MockRepository.GenerateMock<IAuditor>());      
    
            
            // act
            axToWmsPRDManager.Execute();

            //assert           
            //purchPRDListRepositoryMock.VerifyAllExpectations();
            //productionOrderManagerMock.VerifyAllExpectations();
            //purchaseOrderToWmsServiceMock.VerifyAllExpectations();        
    

            purchaseOrderToWmsServiceMock.AssertWasCalled(x => 
x.PurchaseOrderToWMSOperation(purchPRDRequestMock));

        }


the line below throws error :

>  purchaseOrderToWmsServiceMock.AssertWasCalled(x =>
> x.PurchaseOrderToWMSOperation(purchPRDRequestMock));

This is error:


> Rhino.Mocks.Exceptions.ExpectationViolationException occurred  
> HResult=0x80131500  
> 
Message=PurchaseOrderToWMSPort.PurchaseOrderToWMSOperation(Castle.Proxies.PurchaseOrderToWMSOperationRequestProxy2641b9f9d16044aeb43d9f73bb77d369);
> Expected #1, Actual #0.   Source=<Cannot evaluate the exception
> source>   StackTrace:    at
> Rhino.Mocks.RhinoMocksExtensions.AssertWasCalled[T](T mock, Action`1
> action, Action`1 setupConstraints)    at
> Rhino.Mocks.RhinoMocksExtensions.AssertWasCalled[T](T mock, Func`2
> action)    at
> 
ETG.AXHub.BLL.PWSTests.PurchPRD.AxToWmsPurchPRDManagerTests.WhenProducitonOrderList_IsNotFromPaperlessWarehouse_POList_IsNotSent()
> in
> 
C:\AXRepo\ETG.IHub\PWS\ETG.AXHub.BLL.PWSTests\PurchPRD\AxToWmsPurchPRDManagerTests.cs:line
> 84


Could you help me what is going wrong?


**Updates**

> I changed the line as below, still i am getting same error

`purchaseOrderToWmsServiceMock.AssertWasCalled(x => 
x.PurchaseOrderToWMSOperation(Arg<PurchaseOrderToWMSOperationRequest>.Is.Anything));`
 
–



> when i changed the line to below it is NOT throwing any errors

 `purchaseOrderToWmsServiceMock.AssertWasNotCalled(x => 
x.PurchaseOrderToWMSOperation(Arg<PurchaseOrderToWMSOperationRequest>.Is.Anything));`

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rhinomocks+unsubscr...@googlegroups.com.
To post to this group, send email to rhinomocks@googlegroups.com.
Visit this group at https://groups.google.com/group/rhinomocks.
For more options, visit https://groups.google.com/d/optout.

Reply via email to