Ejemplo n.º 1
0
        public void ContentParametersConstructorTest()
        {
            Dictionary <string, string> paramDictionary = null; // TODO: Initialize to an appropriate value
            ContentParameters           target          = new ContentParameters(paramDictionary);

            Assert.Inconclusive("TODO: Implement code to verify target");
        }
Ejemplo n.º 2
0
        public void AddTest()
        {
            ContentParameters target     = new ContentParameters(); // TODO: Initialize to an appropriate value
            string            paramName  = string.Empty;            // TODO: Initialize to an appropriate value
            string            paramValue = string.Empty;            // TODO: Initialize to an appropriate value

            target.Add(paramName, paramValue);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
        private IWebStreamResponse FilterColumns <T>(IWebStreamResponse response, string[] columns, string address, bool async) where T : PrtgObject
        {
            if (columns != null)
            {
                var defaultProperties = ContentParameters <T> .GetDefaultProperties();

                var defaultPropertiesStr = defaultProperties.Select(p => p.GetDescription().ToLower()).ToList();

                var missing = defaultPropertiesStr.Where(p => !columns.Contains(p)).ToList();

                if (missing.Count > 0)
                {
                    string responseStr;

                    if (async)
                    {
                        responseStr = response.GetResponseTextStream(address).Result;
                    }
                    else
                    {
                        responseStr = response.GetResponseText(ref address);
                    }

                    var xDoc = XDocument.Parse(responseStr);

                    var toRemove = xDoc.Descendants("item").Descendants().Where(
                        e =>
                    {
                        var str = e.Name.ToString();

                        if (str.EndsWith("_raw"))
                        {
                            str = str.Substring(0, str.Length - "_raw".Length);
                        }

                        return(missing.Contains(str));
                    }).ToList();

                    foreach (var elm in toRemove)
                    {
                        elm.Remove();
                    }

                    return(new BasicResponse(xDoc.ToString()));
                }
            }

            return(response);
        }
Ejemplo n.º 4
0
        public void ContentParametersTest()
        {
            ContentReplacer_Accessor target = new ContentReplacer_Accessor(); // TODO: Initialize to an appropriate value
            var param = new Dictionary <string, string>();

            param.Add("<barcode>", "8693332221117");
            param.Add("<name>", "plu1");
            IContentParameters expected = new ContentParameters(); // TODO: Initialize to an appropriate value
            IContentParameters actual;

            target.ContentParameters = expected;
            actual = target.ContentParameters;
            Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
Ejemplo n.º 5
0
        private byte[] PrepareContent(string filename)
        {
            // Prepare content parameters and their values
            // Parameters are <ProductName>, <StockCode> & <Barcode>
            // see afterParameterizing.LBL contents
            IContentParameters param = new ContentParameters();

            param.Add("<ProductName>", "My Sample Products");
            param.Add("<StockCode>", "PC-01");
            param.Add("<Barcode>", "8693332221117");

            // Read payload file
            IFileContentReader reader = new FileContentReader(filename);

            byte[] payload = reader.ReadAllAsByte();

            // Do the replacing
            IContentReplacer replacer = new ContentReplacer(param, Encoding.UTF8);

            return(replacer.Replace(payload));
        }
Ejemplo n.º 6
0
        public void ContentParametersConstructorTest1()
        {
            ContentParameters target = new ContentParameters();

            Assert.Inconclusive("TODO: Implement code to verify target");
        }
Ejemplo n.º 7
0
        public async Task <ActionResult <IEnumerable <Content> > > Query([FromQuery] ContentParameters qparams)
        {
            List <Content> contents = new List <Content>();

            // Filter the request as per the query parameters
            if (!string.IsNullOrEmpty(qparams.Ids))
            {
                // Use the ids param to filter for requested content ids
                string [] ids = qparams.Ids.Split(",");

                foreach (string stringId in ids)
                {
                    if (Int32.TryParse(stringId, out int id))
                    {
                        if (id == 1)
                        {
                            contents.Add(new Content {
                                Id    = id,
                                Title = "Welcome to our \"Live Well\" community",
                                Body  = "Our vision is to use an integrated approach to address our population's health and wellness. The Healthy Life Course approach works toward building lasting, improved health and wellness for our people. We support our community based on this approach, which suggests that the health and wellness outcomes of individuals, families, and communities depend on many variables, including universality, equity and community health variables. These can include things that can improve our wellbeing (protective factors) and things that can worsen it (risk factors) throughout life. The model also provides for a broader understanding of the population's health and health service delivery, which is key in pursuing universal health for the current and future populations of the Region.You are welcome to join our \"Live Well\" initiative!"
                            });
                        }
                        else if (id == 2)
                        {
                            contents.Add(new Content
                            {
                                Id    = id,
                                Image = "/static/images/PopulationHealthAndWellness_Gray.png"
                            });
                        }
                        else if (id == 3)
                        {
                            contents.Add(new Content
                            {
                                Id    = id,
                                Title = "USERNAME",
                                Body  = "Please verify your username"
                            });
                        }
                        else if (id == 4)
                        {
                            contents.Add(new Content
                            {
                                Id    = id,
                                Title = "PASSWORD",
                                Body  = "Please verify your password"
                            });
                        }
                        else if (id == 5)
                        {
                            contents.Add(new Content
                            {
                                Id   = id,
                                Body = "Your session has expired, please login again"
                            });
                        }
                        else if (id == 6)
                        {
                            contents.Add(new Content
                            {
                                Id    = id,
                                Title = "Login"
                            });
                        }
                    }
                }
            }

            return(contents);
        }