public void NewFutureOptionCallsTheCorrectMethodFromTheUnderlyingCore() { //Arrange var futureOptionRequestDTO = new NewFutureOptionRequestDTO(); var mockFutureOptionPlacer = MockRepository.GenerateMock<FutureOptionPlacer>(_mockConnection); mockFutureOptionPlacer.Expect(x => x.NewFutureOption(futureOptionRequestDTO)) .Return(new NewFutureOptionResponseDTO()); //Act var response = new FutureOptionService(mockFutureOptionPlacer).NewFutureOption(futureOptionRequestDTO); //Assert Assert.IsInstanceOfType(typeof(NewFutureOptionResponseDTO), response); mockFutureOptionPlacer.VerifyAllExpectations(); }
public void FutureOptionServicePropertyLazyLoadsTheServiceTheFirstTimeItsCalled() { // Arrange var futureOptionServiceReturned = new FutureOptionService(new FutureOptionPlacer(_mockApiConnection.CoreConnection)); _mockFutureOptionServiceFactory.Expect(x => x.Create(_mockApiConnection)) .Return(futureOptionServiceReturned) .Repeat.Once(); // Act var futureOptionService = _serviceManager.FutureOptionService; var serviceSecondCall = _serviceManager.FutureOptionService; // Assert Assert.AreEqual(futureOptionServiceReturned, futureOptionService); Assert.AreEqual(futureOptionService, serviceSecondCall); _mockFutureOptionServiceFactory.VerifyAllExpectations(); }