Ejemplo n.º 1
0
        public async Task FlightControllerTests_Create_ShouldInitializeViewWithReferenceList()
        {
            // Arrange
            var flightController = new FlightsController(_flightCoreServicesMock.Object, _airportCoreServicesMock.Object, _aircraftCoreServicesMock.Object);

            // Act
            var viewResult = await flightController.CreateFlight() as ViewResult;

            var viewData = viewResult.ViewData as ViewDataDictionary;

            // Expected
            var expectedViewDataKeys = new List <string> {
                "aircrafts", "airports"
            };
            var expectedViewDataValues = new List <object> {
                _aircraftsMockData, _airportsMockData
            };

            // Assert
            Check.That(viewResult).IsNotNull();
            Check.That(viewData).IsNotNull();
            Check.That(viewData.Keys.ToList()).ContainsExactly(expectedViewDataKeys);
            Check.That(viewData.Values.ToList()).ContainsExactly(expectedViewDataValues);
        }