Beispiel #1
0
        public JsonResult NewTopicPeople()
        {
            UserAuth();
            var topicid   = Request.Form["topicid"];
            var pps       = Request.Form["pps"];
            var splitstrs = pps.Split(new string[] { " @" }, StringSplitOptions.RemoveEmptyEntries);
            var pplist    = new List <string>();

            foreach (var PP in splitstrs)
            {
                if (PP.Trim().ToUpper().Contains(ViewBag.username.ToUpper()))
                {
                    continue;
                }

                pplist.Add(PP.Replace("@", "").Trim());
            }

            CoTopicVM.UpdateTopicPeople(topicid, pplist, this);

            var ret = new JsonResult();

            ret.Data = new { sucess = true };
            return(ret);
        }
Beispiel #2
0
        public void can_replace_project_properties_in_a_string_given_a_project()
        {
            var project = new Project(Temp("FluentXml.Specs.csproj"));

            var text = "I $configuration$ $WarningLevel$ times faster than $Platform$! It's $DebugSymbols$";

            // Uses Global and default configurations, by default
            PP.Replace(text, project).ShouldEqual("I Debug 4 times faster than AnyCPU! It's true");

            PP.Replace(text, project, includeGlobal: false).ShouldEqual("I Debug 4 times faster than $Platform$! It's true");

            PP.Replace(text, project, config: "Release", includeGlobal: false).ShouldEqual("I Release 4 times faster than $Platform$! It's $DebugSymbols$");
            PP.Replace(text, project, config: "Release", includeGlobal: true).ShouldEqual("I Release 4 times faster than AnyCPU! It's $DebugSymbols$");
        }
Beispiel #3
0
        public void can_replace_arbitrary_tokens_not_associated_with_a_project()
        {
            var text = "hello $foo$ the $money$ costs $9.95 and $bar foo$ is really cool!";

            // Dictionary<string,object>
            PP.Replace(text, new Dictionary <string, object>
            {
                { "foo", 5 }
            }).ShouldEqual("hello 5 the $money$ costs $9.95 and $bar foo$ is really cool!");
            PP.Replace(text, new Dictionary <string, object>
            {
                { "foo", 5.5 }, { "bar foo", "HI" }
            }).ShouldEqual("hello 5.5 the $money$ costs $9.95 and HI is really cool!");
            PP.Replace(text, new Dictionary <string, object>
            {
                { " the ", true }
            }).ShouldEqual("hello $fooTruemoney$ costs $9.95 and $bar foo$ is really cool!");
            PP.Replace(text, new Dictionary <string, object>
            {
                { " the ", true }, { "9.95 and ", 5 }
            }).ShouldEqual("hello $fooTruemoney$ costs 5bar foo$ is really cool!");

            // Dictionary<string,string>
            PP.Replace(text, new Dictionary <string, string>
            {
                { "foo", "5" }
            }).ShouldEqual("hello 5 the $money$ costs $9.95 and $bar foo$ is really cool!");
            PP.Replace(text, new Dictionary <string, string>
            {
                { "foo", "5.5" }, { "bar foo", "HI" }
            }).ShouldEqual("hello 5.5 the $money$ costs $9.95 and HI is really cool!");
            PP.Replace(text, new Dictionary <string, string>
            {
                { " the ", "ABC" }
            }).ShouldEqual("hello $fooABCmoney$ costs $9.95 and $bar foo$ is really cool!");
            PP.Replace(text, new Dictionary <string, string>
            {
                { " the ", "ABC" }, { "9.95 and ", "5" }
            }).ShouldEqual("hello $fooABCmoney$ costs 5bar foo$ is really cool!");

            // anonymous object
            PP.Replace(text, new { foo = 5 }).ShouldEqual("hello 5 the $money$ costs $9.95 and $bar foo$ is really cool!");
            PP.Replace(text, new { foo = 5, money = "WINNING" }).ShouldEqual("hello 5 the WINNING costs $9.95 and $bar foo$ is really cool!");
        }