예제 #1
0
        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"));
        }
예제 #2
0
 public void OneTimeTearDown()
 {
     System.Diagnostics.Debug.WriteLine("OneTimeTearDown is called");
     sut = null;
 }
예제 #3
0
 public void OneTimeSetUp()
 {
     System.Diagnostics.Debug.WriteLine("OneTimeSetup is called");
     sut = new FlightService();
 }