Skip to content
This repository has been archived by the owner on Oct 21, 2018. It is now read-only.

InvalidCastException #27

Open
rhodri80 opened this issue Jun 15, 2018 · 0 comments
Open

InvalidCastException #27

rhodri80 opened this issue Jun 15, 2018 · 0 comments

Comments

@rhodri80
Copy link

Hi
This is an issue that has been reported before but we are getting this error in out nunit test run from Resharper. This seems to crash the second time we call dataProvider.Stub(p => p.GetDataAccessor()). There does not seem to be much difference in the arguments passed. We rebuilt rhino mocks from the latest code but now it fails although the code does not appear to have altered significantly.

var dataProvider = MockRepository.GenerateStub();
var dataConsumer = MockRepository.GenerateMock();
var calculationEngine = MockRepository.GenerateStub();

        var configuration =
            new AnalysisConfiguration
            {
                Calculations = new ICalculationInstance[0],

                Switches = new IConnectionSwitch[]
                               {
                                   new ConnectionSwitch
                                       {
                                           Name = "Switch1",
                                           InputSelector = controlData => controlData["SwitchInput"] as string,
                                           MissingInputIsError = false
                                       }
                               },

                DataConnections = new IDataConnection[]
                                          {
                                              new DataConnection(
                                                  new ConnectionEndPoint(PortType.Source, "Matrix2", "A"),
                                                  new ConnectionEndPoint(PortType.SwitchControl, "Switch1", "SwitchInput")),
                                              new DataConnection(
                                                  new ConnectionEndPoint(PortType.Source, "Matrix1", "A"),
                                                  new ConnectionEndPoint(PortType.SwitchData, "Switch1", "Default")),
                                              new DataConnection(
                                                  new ConnectionEndPoint(PortType.SwitchData, "Switch1"),
                                                  new ConnectionEndPoint(PortType.Output, "Matrix O", "Result 1")),
                                          }

            };

        Func<object[]> matrix2AData = () => new object[] { "PortThatIsNotThere" };
        dataProvider.Stub(p => p.GetDataAccessor("Matrix2", "A")).Return(matrix2AData);
        Func<object[]> matrix1AData = () => new object[] { "DataToPassThroughSwitch" };
        dataProvider.Stub(p => p.GetDataAccessor("Matrix1", "A")).Return(matrix1AData);

System.InvalidCastException : Unable to cast object of type 'ProxyDelegate_Func1_1Proxyd8161f67c1804dbd8af18811e7a851ec' to type 'System.Func1[System.Object[]]'.
at IDataProviderProxy651fe23982b74be18df82b14e787d7f1.GetDataAccessor(String matrixID, String channelID, Boolean timeShift)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant