public async void CreateNewComponentAsNonAdminTest()
        {
            //create location
            await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(1));

            //begin building new component
            Dictionary <string, StringValues> formdata = new Dictionary <string, StringValues>();

            formdata.Add("Name", "Stippentrap");
            formdata.Add("Description", "Leg jij behendig als een antilope het stippenparcour af?");
            formdata.Add("Exercises", "1");
            AddExerciseToDatabase(1);

            HttpRequest requestmessage = await HttpRequestFactory.CreateFormDataRequest(formdata, HttpMethod.Post);

            ObjectResult resultUser = (ObjectResult)await this.componentController.ComponentCreate(requestmessage, 1, this.userClaim);

            ObjectResult resultOrganiser = (ObjectResult)await this.componentController.ComponentCreate(requestmessage, 1, this.organiserClaim);

            ErrorResponse errorResponseUser      = (ErrorResponse)resultUser.Value;
            ErrorResponse errorResponseOrganiser = (ErrorResponse)resultOrganiser.Value;

            // status code should be 403 FORBIDDEN
            Assert.Equal(403, resultUser.StatusCode);
            Assert.Equal(403, resultOrganiser.StatusCode);

            Assert.Equal(ErrorCode.UNAUTHORIZED_ROLE_NO_PERMISSIONS, errorResponseUser.ErrorCodeEnum);
            Assert.Equal(ErrorCode.UNAUTHORIZED_ROLE_NO_PERMISSIONS, errorResponseOrganiser.ErrorCodeEnum);
        }
        public async void UpdateComponentAsAdminDescriptionTooShortTest()
        {
            //create location and location
            Location location = await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(1));

            await this.componentRepository.CreateAsync(ComponentFactory.CreateComponent(1, location));

            //begin building new component
            Dictionary <string, StringValues> formdata = new Dictionary <string, StringValues>();

            formdata.Add("Name", "Stippentrap");
            formdata.Add("Description", "X");
            formdata.Add("Exercises", "1");
            AddExerciseToDatabase(1);

            HttpRequest requestmessage = await HttpRequestFactory.CreateFormDataRequest(formdata, HttpMethod.Put);

            ObjectResult result = (ObjectResult)await this.componentController.ComponentUpdateById(requestmessage, 1, 1, this.adminClaim);

            ErrorResponse errorResponse = (ErrorResponse)result.Value;

            // status code should be 400 "Description must be at least 2 characters"
            Assert.Equal(400, result.StatusCode);
            Assert.Equal("Description must be at least 2 characters", errorResponse.Message);
        }
Пример #3
0
        public async void UpdateLocationAsAdminTest()
        {
            // create user
            await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(5));

            // create updated user
            Dictionary <string, StringValues> formdata = new Dictionary <string, StringValues>();

            formdata.Add("Name", "Skillgarden IJmuiden");
            formdata.Add("City", "IJmuiden Noord");
            formdata.Add("Lat", "1.3214");
            formdata.Add("Lng", "1.2343");

            // create put request
            HttpRequest putrequestmessage = await HttpRequestFactory.CreateFormDataRequest(formdata, HttpMethod.Put);

            ObjectResult result = (ObjectResult)await this.locationController.LocationUpdate(putrequestmessage, 5, this.adminClaim);

            Location resultLocation = (Location)result.Value;

            // status code should be 200 OK
            Assert.Equal(200, result.StatusCode);
            // the email should be updated
            Assert.Equal("Skillgarden IJmuiden", resultLocation.Name);
        }
        public async void UpdateComponentAsAdminComponentNotFoundTest()
        {
            //create location and location
            Location location = await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(1));

            await this.componentRepository.CreateAsync(ComponentFactory.CreateComponent(1, location));

            //begin building new component
            Dictionary <string, StringValues> formdata = new Dictionary <string, StringValues>();

            formdata.Add("Name", "Stippentrap");
            formdata.Add("Description", "Leg jij behendig als een antilope het stippenparcour af?");
            formdata.Add("Exercises", "1");
            AddExerciseToDatabase(1);

            HttpRequest requestmessage = await HttpRequestFactory.CreateFormDataRequest(formdata, HttpMethod.Put);

            ObjectResult result = (ObjectResult)await this.componentController.ComponentUpdateById(requestmessage, 1, 5, this.adminClaim);

            ErrorResponse errorResponse = (ErrorResponse)result.Value;

            // status code should be 404 not found
            Assert.Equal(404, result.StatusCode);
            Assert.Equal(ErrorCode.COMPONENT_NOT_FOUND, errorResponse.ErrorCodeEnum);
        }
        public async void UpdateComponentAsAdminNameTooLongTest()
        {
            //create location and location
            Location location = await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(1));

            await this.componentRepository.CreateAsync(ComponentFactory.CreateComponent(1, location));

            //begin building new component
            Dictionary <string, StringValues> formdata = new Dictionary <string, StringValues>();

            formdata.Add("Name", "Stippentrap gelegen naast de glijbaan in de skillgarden van Almere");
            formdata.Add("Description", "Leg jij behendig als een antilope het stippenparcour af?");
            formdata.Add("Exercises", "1");
            AddExerciseToDatabase(1);

            HttpRequest requestmessage = await HttpRequestFactory.CreateFormDataRequest(formdata, HttpMethod.Put);

            ObjectResult result = (ObjectResult)await this.componentController.ComponentUpdateById(requestmessage, 1, 1, this.adminClaim);

            ErrorResponse errorResponse = (ErrorResponse)result.Value;

            // status code should be 401 UNAUTHORIZED
            Assert.Equal(400, result.StatusCode);
            Assert.Equal("Name can not be longer than 50 characters", errorResponse.Message);
        }
        public async void UpdateComponentAsNonAdminTest()
        {
            //create location and location
            Location location = await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(1));

            await this.componentRepository.CreateAsync(ComponentFactory.CreateComponent(1, location));

            //begin building new component
            Dictionary <string, StringValues> formdata = new Dictionary <string, StringValues>();

            formdata.Add("Name", "Fiets parcour");
            formdata.Add("Description", "Race jij het snelst door de blauwe racebaan heen?");
            formdata.Add("Exercises", "1");
            AddExerciseToDatabase(1);

            HttpRequest requestmessage = await HttpRequestFactory.CreateFormDataRequest(formdata, HttpMethod.Put);

            ObjectResult resultUser = (ObjectResult)await this.componentController.ComponentUpdateById(requestmessage, 1, 1, this.userClaim);

            ObjectResult resultOrganiser = (ObjectResult)await this.componentController.ComponentUpdateById(requestmessage, 1, 1, this.organiserClaim);

            ErrorResponse errorMessageUser      = (ErrorResponse)resultUser.Value;
            ErrorResponse errorMessageOrganiser = (ErrorResponse)resultOrganiser.Value;

            // status code should be 403 FORBIDDEN
            Assert.Equal(403, resultUser.StatusCode);
            Assert.Equal(403, resultOrganiser.StatusCode);

            Assert.Equal(ErrorCode.UNAUTHORIZED_ROLE_NO_PERMISSIONS, errorMessageUser.ErrorCodeEnum);
            Assert.Equal(ErrorCode.UNAUTHORIZED_ROLE_NO_PERMISSIONS, errorMessageOrganiser.ErrorCodeEnum);
        }
        public async void GetAllComponentsByLocationIdTest()
        {
            Location location1 = await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(1));

            Location location2 = await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(2));

            // create components for location 1
            await this.componentRepository.CreateAsync(ComponentFactory.CreateComponent(1, location1));

            await this.componentRepository.CreateAsync(ComponentFactory.CreateComponent(2, location1));

            await this.componentRepository.CreateAsync(ComponentFactory.CreateComponent(3, location1));

            //create components for location 2
            await this.componentRepository.CreateAsync(ComponentFactory.CreateComponent(4, location2));

            await this.componentRepository.CreateAsync(ComponentFactory.CreateComponent(5, location2));

            HttpRequest request = HttpRequestFactory.CreateGetRequest();

            //get all components location 1
            ObjectResult result = (ObjectResult)await this.componentController.ComponentsGetAll(request, 1);

            List <Component> components = (List <Component>)result.Value;

            // status code should be 200 OK
            Assert.Equal(200, result.StatusCode);
            // amount of found locations should be 3 for location 1
            Assert.Equal(3, components.Count);
        }
        public async void UpdateComponentAsAdminTest()
        {
            //create location and location
            Location location = await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(1));

            await this.componentRepository.CreateAsync(ComponentFactory.CreateComponent(1, location));

            //begin building new component
            Dictionary <string, StringValues> formdata = new Dictionary <string, StringValues>();

            formdata.Add("Name", "Fiets parcour");
            formdata.Add("Description", "Race jij het snelst door de blauwe racebaan heen?");
            formdata.Add("Exercises", "1");
            AddExerciseToDatabase(1);

            HttpRequest requestmessage = await HttpRequestFactory.CreateFormDataRequest(formdata, HttpMethod.Put);

            ObjectResult result = (ObjectResult)await this.componentController.ComponentUpdateById(requestmessage, 1, 1, this.adminClaim);

            ComponentResponse resultComponent = (ComponentResponse)result.Value;

            // status code should be 200 OK
            Assert.Equal(200, result.StatusCode);
            Assert.Equal("Fiets parcour", resultComponent.Name);
        }
Пример #9
0
        public async void UpdateLocationAsNonAdminTest()
        {
            // create user
            await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(5));

            await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(10));

            // create updated user
            Dictionary <string, StringValues> formdata = new Dictionary <string, StringValues>();

            formdata.Add("Name", "Skillgarden IJmuiden");
            formdata.Add("City", "IJmuiden Noord");
            formdata.Add("Lat", "1.3214");
            formdata.Add("Lng", "1.2343");

            // create put request
            HttpRequest putrequestmessage = await HttpRequestFactory.CreateFormDataRequest(formdata, HttpMethod.Put);

            ObjectResult resultUser = (ObjectResult)await this.locationController.LocationUpdate(putrequestmessage, 5, this.userClaim);

            ObjectResult resultOrganiser = (ObjectResult)await this.locationController.LocationUpdate(putrequestmessage, 10, this.organiserClaim);

            ErrorResponse errorMessageUser      = (ErrorResponse)resultUser.Value;
            ErrorResponse errorMessageOrganiser = (ErrorResponse)resultOrganiser.Value;

            // status code should be 403 FORBIDDEN
            Assert.Equal(403, resultUser.StatusCode);
            Assert.Equal(403, resultOrganiser.StatusCode);

            Assert.Equal(ErrorCode.UNAUTHORIZED_ROLE_NO_PERMISSIONS, errorMessageUser.ErrorCodeEnum);
            Assert.Equal(ErrorCode.UNAUTHORIZED_ROLE_NO_PERMISSIONS, errorMessageOrganiser.ErrorCodeEnum);
        }
        public async void GetAllEventsTest()
        {
            //Create 1 location using the locationFactory
            Location locationTest = await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(1));

            //Create 2 Events using the eventFactory
            Event event1 = await this.eventRepository.CreateAsync(EventFactory.CreateEvent(1, 1, 1));

            Event event2 = await this.eventRepository.CreateAsync(EventFactory.CreateEvent(2, 1, 1));

            var test = await this.eventRepository.ListAsync();

            HttpRequest request = HttpRequestFactory.CreateGetRequest();

            ObjectResult result = (ObjectResult)await eventController.LocationGetEvents(request, locationTest.Id);

            List <EventResponse> events = (List <EventResponse>)result.Value;

            // Status code should return 200 OK
            Assert.Equal(200, result.StatusCode);
            // Count of events should equal 2
            Assert.Equal(2, events.Count);

            //Check if organisorId is the same for both
            Assert.Equal(1, event1.OrganisorId);
            Assert.Equal(1, event2.OrganisorId);
        }
Пример #11
0
 protected override Location <T> Execute(CodeActivityContext context)
 {
     if (_locationFactory == null)
     {
         _locationFactory = ExpressionUtilities.CreateLocationFactory <T>(_rewrittenTree);
     }
     return(_locationFactory.CreateLocation(context));
 }
Пример #12
0
        public void CreateLocation_BlankLegalName_ThrowsArgumentException()
        {
            var locationRepository = new Mock <ILocationRepository> ();
            var locationFactory    = new LocationFactory(locationRepository.Object);
            var agency             = new Mock <Agency> ();

            locationFactory.CreateLocation(agency.Object,
                                           new LocationProfileBuilder().WithLocationName(new LocationNameBuilder().WithName("   ")));
        }
Пример #13
0
        public void FinishRequest(string inName, string inLatitude, string inLongitude, string inDepth, string inComment)
        {
            Location location;
            double   latitude, longitude, depth;

            // validate fields
            try
            {
                // location name
                CommonPresenterStuff.ValidateFieldNotEmpty(_view.LocationName, "name");

                // latitude
                CommonPresenterStuff.ValidateFieldNotEmpty(_view.Latitude, "latitude");
                latitude = CommonPresenterStuff.ValidateDoubleString(_view.Latitude, "latitude");
                CommonPresenterStuff.ValidateDoubleInRange(latitude, -90.0, 90.0, "latitude");

                // longitude
                CommonPresenterStuff.ValidateFieldNotEmpty(_view.Longitude, "longitude");
                longitude = CommonPresenterStuff.ValidateDoubleString(_view.Longitude, "longitude");
                CommonPresenterStuff.ValidateDoubleInRange(longitude, -180.0, 180.0, "longitude");

                // depth
                CommonPresenterStuff.ValidateFieldNotEmpty(_view.Depth, "depth");
                depth = CommonPresenterStuff.ValidateDoubleString(_view.Depth, "depth");
                CommonPresenterStuff.ValidateDoubleGreaterThan(depth, 0.0, "depth");
            }
            catch (Exception e)
            {
                _view.ShowErrorMessage(e.Message);
                return;
            }

            // if comment is empty, warn user
            if (_view.Comment == "")
            {
                if (!_view.WarnUser(CommonPresenterStuff.WarnFieldEmptyMessage("comment")))
                {
                    return;
                }
            }

            // try creating location
            try
            {
                location = LocationFactory.CreateLocation(inName, latitude, longitude, depth, inComment);
            }
            catch (Exception)
            {
                _view.ShowErrorMessage(CommonPresenterStuff.ErrorMessage());
                return;
            }

            Finish(location);
        }
Пример #14
0
 protected override Location <TResult> Execute(CodeActivityContext context)
 {
     if (expressionTree == null)
     {
         return((Location <TResult>)invoker.InvokeExpression(context));
     }
     if (locationFactory == null)
     {
         locationFactory = ExpressionUtilities.CreateLocationFactory <TResult>(this.expressionTree);
     }
     return(locationFactory.CreateLocation(context));
 }
Пример #15
0
        public void CreateLocation_NullAgency_ThrowsArgumentException()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture(serviceLocatorFixture);
                var locationRepository = new Mock <ILocationRepository>();
                var locationFactory    = new LocationFactory(locationRepository.Object);

                locationFactory.CreateLocation(null, new LocationProfileBuilder().WithLocationName(new LocationNameBuilder().WithName(LegalName)));
            }
        }
Пример #16
0
        public void CreateLocation_NullLegalName_ThrowsArgumentException()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture(serviceLocatorFixture);
                var locationRepository = new Mock <ILocationRepository>();
                var locationFactory    = new LocationFactory(locationRepository.Object);
                var agency             = new Mock <Agency>();

                locationFactory.CreateLocation(agency.Object, null);
            }
        }
Пример #17
0
        public async void GetSpecificLocationNotFoundTest()
        {
            await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(10));

            HttpRequest request = HttpRequestFactory.CreateGetRequest();

            ObjectResult result = (ObjectResult)await this.locationController.LocationGet(request, 5);

            ErrorResponse errorResponse = (ErrorResponse)result.Value;

            // status code should be 404 not found
            Assert.Equal(404, result.StatusCode);
            Assert.Equal(ErrorCode.LOCATION_NOT_FOUND, errorResponse.ErrorCodeEnum);
        }
Пример #18
0
        //Location[,] _locations = new Location[100,100];

        internal void CreateLocationAtPoint(int XCoord, int YCoord, int dangerLevel, bool forceSpawn = false)
        {
            Location loc = LocationAt(XCoord, YCoord);

            if (loc != null)
            {
                return;
            }


            loc             = LocationFactory.CreateLocation(dangerLevel, forceSpawn);
            loc.XCoordinate = XCoord;
            loc.YCoordinate = YCoord;
            _locations.Add(loc);
        }
Пример #19
0
        public async void DeleteLocationAsAdminTest()
        {
            // create location
            await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(9000));

            // create delete request
            HttpRequest deleteRequest = HttpRequestFactory.CreateDeleteRequest();

            OkResult result = (OkResult)await this.locationController.LocationDelete(deleteRequest, 9000, this.adminClaim);

            // status code should be 200 OK
            Assert.Equal(200, result.StatusCode);
            // the account should be removed
            Assert.Empty(await this.locationRepository.ListAsync());
        }
Пример #20
0
        public async void GetSpecificLocationTest()
        {
            await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(10));

            HttpRequest request = HttpRequestFactory.CreateGetRequest();

            ObjectResult result = (ObjectResult)await this.locationController.LocationGet(request, 10);

            Location location = (Location)result.Value;

            // status code should be 200 OK
            Assert.Equal(200, result.StatusCode);
            // check if the right location was found
            Assert.Equal(10, location.Id);
        }
Пример #21
0
        public async void DeleteLocationAsAdminNotFoundTest()
        {
            // create location
            await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(9000));

            // create delete request
            HttpRequest deleteRequest = HttpRequestFactory.CreateDeleteRequest();

            ObjectResult result = (ObjectResult)await this.locationController.LocationDelete(deleteRequest, 1, this.adminClaim);

            ErrorResponse errorResponse = (ErrorResponse)result.Value;

            // status code should be 404 not found
            Assert.Equal(404, result.StatusCode);
            Assert.Equal(ErrorCode.LOCATION_NOT_FOUND, errorResponse.ErrorCodeEnum);
        }
Пример #22
0
        public void CreateLocation_GivenValidArguments_CreatesALocation()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture(serviceLocatorFixture);
                var locationRepository = new Mock <ILocationRepository>();
                var locationFactory    = new LocationFactory(locationRepository.Object);
                var agency             = new Mock <Agency>();

                var location = locationFactory.CreateLocation(
                    agency.Object, new LocationProfileBuilder().WithLocationName(new LocationNameBuilder().WithName(LegalName)));

                Assert.IsNotNull(location);
            }
        }
        public async void GetSpecificComponentNotFoundTest()
        {
            Location location1 = await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(1));

            await this.componentRepository.CreateAsync(ComponentFactory.CreateComponent(1, location1));

            HttpRequest request = HttpRequestFactory.CreateGetRequest();

            ObjectResult result = (ObjectResult)await this.componentController.ComponentsGetById(request, 1, 5);

            ErrorResponse errorResponse = (ErrorResponse)result.Value;

            // status code should be 200 OK
            Assert.Equal(404, result.StatusCode);
            // should return component not found errorresponse
            Assert.Equal(ErrorCode.COMPONENT_NOT_FOUND, errorResponse.ErrorCodeEnum);
        }
        public async void CreateNewComponentAsAdminEmptyFormdataTest()
        {
            //create location
            await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(1));

            Dictionary <string, StringValues> formdata = new Dictionary <string, StringValues>();

            HttpRequest requestmessage = await HttpRequestFactory.CreateFormDataRequest(formdata, HttpMethod.Post, "empty");

            ObjectResult result = (ObjectResult)await this.componentController.ComponentCreate(requestmessage, 1, this.adminClaim);

            ErrorResponse errorResponse = (ErrorResponse)result.Value;

            // status code should be 400 INVALID_REQUEST_BODY
            Assert.Equal(400, result.StatusCode);
            Assert.Equal(ErrorCode.INVALID_REQUEST_BODY, errorResponse.ErrorCodeEnum);
        }
        public async void DeleteComponentAsAdminTest()
        {
            //create location and component
            Location location = await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(1));

            await this.componentRepository.CreateAsync(ComponentFactory.CreateComponent(1, location));

            // create delete request
            HttpRequest deleteRequest = HttpRequestFactory.CreateDeleteRequest();

            OkResult result = (OkResult)await this.componentController.ComponentDelete(deleteRequest, 1, 1, this.adminClaim);

            // status code should be 200 OK
            Assert.Equal(200, result.StatusCode);
            // the account should be removed
            Assert.Empty(await this.componentRepository.ListAsync());
        }
Пример #26
0
        public void CreateLocation_GivenValidArguments_LocationIsEditable()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture(serviceLocatorFixture);
                var locationRepository = new Mock <ILocationRepository>();
                var locationFactory    = new LocationFactory(locationRepository.Object);
                var agency             = new Mock <Agency>();

                var location = locationFactory.CreateLocation(
                    agency.Object,
                    new LocationProfileBuilder().WithLocationName(new LocationNameBuilder().WithName(LegalName)));

                location.ReviseLocationProfile(
                    new LocationProfileBuilder().WithLocationName(new LocationNameBuilder().WithName("Some Name").Build()).Build());
            }
        }
        public async void DeleteComponentAsAdminNotFoundTest()
        {
            //create location and component
            Location location = await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(1));

            await this.componentRepository.CreateAsync(ComponentFactory.CreateComponent(1, location));

            // create delete request
            HttpRequest deleteRequest = HttpRequestFactory.CreateDeleteRequest();

            ObjectResult result = (ObjectResult)await this.componentController.ComponentDelete(deleteRequest, 1, 5, this.adminClaim);

            ErrorResponse errorResponse = (ErrorResponse)result.Value;

            // status code should be 404 not found
            Assert.Equal(404, result.StatusCode);
            Assert.Equal(ErrorCode.COMPONENT_NOT_FOUND, errorResponse.ErrorCodeEnum);
        }
        public async void CreateNewComponentAsAdminImageToBigTest()
        {
            //create location
            await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(1));

            Dictionary <string, StringValues> formdata = new Dictionary <string, StringValues>();

            formdata.Add("Name", "Stippentrap");
            formdata.Add("Description", "Leg jij behendig als een antilope het stippenparcour af?");
            formdata.Add("Exercises", "1");
            AddExerciseToDatabase(1);

            HttpRequest requestmessage = await HttpRequestFactory.CreateFormDataRequest(formdata, HttpMethod.Post, "toBigImage");

            ObjectResult result = (ObjectResult)await this.componentController.ComponentCreate(requestmessage, 1, this.adminClaim);

            // status code should be 400
            Assert.Equal(400, result.StatusCode);
        }
Пример #29
0
        public async void GetAllLocationsTest()
        {
            await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(1));

            await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(2));

            await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(3));

            HttpRequest request = HttpRequestFactory.CreateGetRequest();

            ObjectResult result = (ObjectResult)await this.locationController.LocationGetAll(request);

            List <Location> locations = (List <Location>)result.Value;

            // status code should be 200 OK
            Assert.Equal(200, result.StatusCode);
            // amount of found locations should be 3
            Assert.Equal(3, locations.Count);
        }
        public async void GetSpecificComponentTest()
        {
            Location location1 = await this.locationRepository.CreateAsync(LocationFactory.CreateLocation(1));

            await this.componentRepository.CreateAsync(ComponentFactory.CreateComponent(1, location1));

            await this.componentRepository.CreateAsync(ComponentFactory.CreateComponent(2, location1));

            HttpRequest request = HttpRequestFactory.CreateGetRequest();

            ObjectResult result = (ObjectResult)await this.componentController.ComponentsGetById(request, 1, 1);

            ComponentResponse component = (ComponentResponse)result.Value;

            // status code should be 200 OK
            Assert.Equal(200, result.StatusCode);
            // check if the right location was found
            Assert.Equal(1, component.Id);
        }