Пример #1
0
        public async Task LoadData()
        {
            var parks = await _parkService.GetAllParks();

            Parks.Clear();
            foreach (var park in parks)
            {
                Parks.Add(park);
            }
        }
Пример #2
0
        public async Task ParkService_GetAllParks_ReturnsFullList()
        {
            var underTest = new ParkService(_parkRepositoryMock.Object);

            underTest.Should().NotBeNull("because we expect an instance to be created.");

            var result = await underTest.GetAllParks() as IList <Park>;

            result.Should().NotBeNull("because we expect a result.");
            result.Should().HaveCount(DummyParks.Count(), "because the returned count should match DummyParks count.");
        }
        public void DisplayParks()
        {
            IList <Park> parks = ParkService.GetAllParks();

            foreach (Park park in parks)
            {
                string para = ")";
                Console.WriteLine(park.ParkId.ToString() + para.PadRight(10) + park.Name.ToString().PadRight(5));
            }
            Console.ReadLine();
        }
        public DevParksQuery(ParkService parkService)
        {
            _parkService = parkService;
            var idArgs = new QueryArguments(new QueryArgument <IdGraphType> {
                Name = "id"
            });

            Field <ListGraphType <ParkType> >("parks", resolve: context => _parkService.GetAllParks());
            Field <ParkType>("park", arguments: idArgs,
                             resolve: context => _parkService.GetParkById(context.GetArgument <string>("id")));

            Field <ListGraphType <RideType> >("rides", resolve: context => _parkService.GetRides());
            Field <RideType>("ride", arguments: idArgs,
                             resolve: context => _parkService.GetRideById(context.GetArgument <string>("id")));
        }