Ejemplo n.º 1
0
 public void RemoveInstrument(instrument instrument)
 {
     if (instrumentList.ContainsKey(instrument.name))
     {
         instrumentList.Remove(instrument.name);
     }
 }
Ejemplo n.º 2
0
        public async Task <IActionResult> Post([FromBody] instrument entity)
        {
            try
            {
                if (!isValid(entity))
                {
                    return(new BadRequestResult());
                }

                var loggedInMember = LoggedInUser();
                if (loggedInMember == null)
                {
                    return(new BadRequestObjectResult("Invalid input parameters"));
                }

                entity.last_updated    = DateTime.Now;
                entity.last_updated_by = loggedInMember.member_id;

                //sm(agent.Messages);
                return(Ok(await agent.Add <instrument>(entity)));
            }
            catch (Exception ex)
            {
                //sm(agent.Messages);
                return(await HandleExceptionAsync(ex));
            }
        }
Ejemplo n.º 3
0
        public void installApplication(string repositoryKey, instrument inst)
        {
            log("install Application: " + repositoryKey + " , instrumentation: " + inst.ToString());

            string command = "mobile:application:install";
            Dictionary <string, object> parameters = new Dictionary <string, Object>();

            parameters.Add("file", repositoryKey);
            parameters.Add("instrument", inst.ToString());
            driver.ExecuteScript(command, parameters);
        }
Ejemplo n.º 4
0
        public void setupAndConnect()
        {
            this.host                = getTestProp(Library.testProp.host);
            this.user                = HttpUtility.UrlEncode(getTestProp(Library.testProp.user));
            this.password            = HttpUtility.UrlEncode(getTestProp(Library.testProp.pass));
            this.type                = getTestProp(Library.testProp.type);
            this.os                  = (getTestProp(Library.testProp.os) == "") ? null : getTestProp(Library.testProp.os);
            this.version             = (getTestProp(Library.testProp.version) == "") ? null : getTestProp(Library.testProp.version);
            this.manufacturer        = (getTestProp(Library.testProp.manufacturer) == "") ? null : getTestProp(Library.testProp.manufacturer);
            this.model               = (getTestProp(Library.testProp.model) == "") ? null : getTestProp(Library.testProp.model);
            this.browser             = (getTestProp(Library.testProp.browser) == "") ? null : getTestProp(Library.testProp.browser);
            this.deviceID            = (getTestProp(Library.testProp.deviceid) == "") ? "" : getTestProp(Library.testProp.deviceid);
            this.testType            = (getTestProp(Library.testProp.testType) == "") ? null : getTestProp(Library.testProp.testType);
            this.applicationName     = (getTestProp(Library.testProp.applicationName) == "") ? null : getTestProp(Library.testProp.applicationName);
            this.repositoryKey       = (getTestProp(Library.testProp.repositoryKey) == "") ? null : getTestProp(Library.testProp.repositoryKey);
            this.uploadLocation      = (getTestProp(Library.testProp.uploadLocation) == "") ? null : getTestProp(Library.testProp.uploadLocation);
            this.snapshotDirectory   = (getTestProp(Library.testProp.snapshotDirectory) == "") ? null : getTestProp(Library.testProp.snapshotDirectory);
            this.attachmentDirectory = (getTestProp(Library.testProp.attachmentDirectory) == "") ? null : getTestProp(Library.testProp.attachmentDirectory);
            this.reportDirectory     = (getTestProp(Library.testProp.reportDirectory) == "") ? null : getTestProp(Library.testProp.reportDirectory);
            this.pageObjects         = (getTestProp(Library.testProp.pageObjects) == "") ? "" : getTestProp(Library.testProp.pageObjects);
            this.overwriteUpload     = (getTestProp(Library.testProp.overwriteUpload) == "") ? false : bool.Parse(getTestProp(Library.testProp.overwriteUpload));
            this.implicitWaitTime    = (getTestProp(Library.testProp.implicitWaitTime) == "") ? 0 : int.Parse(getTestProp(Library.testProp.implicitWaitTime));
            this.pageLoadTime        = (getTestProp(Library.testProp.pageLoadTime) == "") ? 0 : int.Parse(getTestProp(Library.testProp.pageLoadTime));


            if (getTestProp(testProp.instrument) == "true")
            {
                this.instrumentApp = instrument.instrument;
            }
            else if (getTestProp(testProp.instrument) == "false")
            {
                this.instrumentApp = instrument.noinstrument;
            }


            if (pageObjects != "")
            {
                loadPageProperty(getTestProp(Library.testProp.pageObjects));
            }

            connectLab();



            if (os == "Android" && testType == "Web")
            {
                cleanApplication("chrome");
            }
        }
        public async Task Post()
        {
            //Arrange
            var entity = new instrument()
            {
                sensor_type_id = 4, site_id = 444
            };

            //Act
            var response = await controller.Post(entity);

            // Assert
            var okResult = Assert.IsType <OkObjectResult>(response);
            var result   = Assert.IsType <instrument>(okResult.Value);

            Assert.Equal(4, result.sensor_type_id);
            Assert.Equal(444, result.site_id);
        }