public void GetFlight_ShouldReturnFlightObject() { //Create the mocked object Mock<IFlightRepository> mockedFlightRepository= new Mock<IFlightRepository>(); //setup the mocked object with the correct repsonse mockedFlightRepository.Setup(x => x.getFlight()).Returns(new FlightEntity() { FlightNumber = "EK987" }); //Inject the mocked object using the dependency injection var flightService = new FlightService(mockedFlightRepository.Object); System.Diagnostics.Debug.WriteLine("getFlight is being asserted"); //Call the method under test var flightEntity = flightService.GetFlight(); //Assert the value Assert.That(flightEntity.FlightNumber, Is.EqualTo("EK987")); }
public void OneTimeTearDown() { System.Diagnostics.Debug.WriteLine("OneTimeTearDown is called"); sut = null; }
public void OneTimeSetUp() { System.Diagnostics.Debug.WriteLine("OneTimeSetup is called"); sut = new FlightService(); }