chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
Hi,
i m having a weird problem.i m mocking a method and when i run this test sometimes it passes and sometitmes it fails.what happens is it fails while creating a new instance of an object and gives the following error
"System.InvalidProgramException.CLR detected an invalid program".Another reason for my confusion is that the exception is coming from a different class than the one i m mocking.here is the code of my test

MakeReservationRequest request = ConstructValidNRSReservationRequest("O",1);
MakeReservationResponse response = new MakeReservationResponse();
Mock reservationController = MockManager.Mock(typeof(ReservationValidator));
Mock seatReservationController = MockManager.Mock(typeof(SeatReservationController));
Mock reservationServiceAgent = MockManager.Mock(typeof(ReservationServiceAgent));
response.MessageHeader = new global::Ttl.Tissip.Messages.Common.CommonTypes.ResponseMessageHeaderType();
response.ResponseDetails = new ResponseDetails();
ReservationValidator.NRSSeatReservationStatusCode reservationCode = new ReservationValidator.NRSSeatReservationStatusCode();
reservationCode = ReservationValidator.NRSSeatReservationStatusCode.NoSeatsAvailable;
reservationController.ExpectAndReturn("SeatReservationStatusCode", reservationCode);
seatReservationController.ExpectAndReturn("ProcessReservations", true);
response = ReservationController.RequestForReservation(request);
Assert.IsTrue(true, "Test for NCover failed.");
reservationController.Clear();
seatReservationController.Clear();
reservationServiceAgent.Clear();
reservationController.Verify();
seatReservationController.Verify();
reservationServiceAgent.Verify();
MockManager.Verify();
thank you
asked by chitranjang (640 points)

2 Answers

0 votes
Hi
If it is possible can you please post the tested code
so I can run the test myself?
answered by ohad (35.4k points)
0 votes
actually the code is very modular and requires licensed 3rd party support so u wont be able to run it.sorry...however would appreciate any help that you could offer.thank you
answered by chitranjang (640 points)
...