コード例 #1
0
        public void ActionCanBeUsedToSimulateAnonymousFunctions()
        {
            string resultString = String.Empty;
            var t = new { Action = new Action<string>((s) => resultString = s) };
            t.Action(TestString);

            Assert.Equal(resultString, TestString);
        }
コード例 #2
0
        public void AddParameters_AnonymousType_AddsAllPropertiesAsParameters()
        {
            var parameters = new {Id = 1, Name = "Reginald", DateOfBirth = new DateTime(1985, 10, 08)};

            var cmd = new SqlCommand();
            cmd.AddParameters(parameters, s => s.ToSnakeCase().ToLower());

            var commandParameters = cmd.Parameters.Cast<SqlParameter>().ToDictionary(p => p.ParameterName, p => p.Value);
            var commandParameterKeys = commandParameters.Select(p => p.Key).ToArray();

            var expectedKeys = new[] {"id", "name", "date_of_birth"};

            expectedKeys.Action(k => Assert.That(commandParameterKeys.Contains(k)));

            Assert.AreEqual(1, cmd.Parameters["id"].Value);
            Assert.AreEqual("Reginald", cmd.Parameters["name"].Value);
            Assert.AreEqual(new DateTime(1985, 10, 08), cmd.Parameters["date_of_birth"].Value);
        }
コード例 #3
0
ファイル: UserSearchDBO.cs プロジェクト: Exclr8/CloudCore
 public override string NavigateURL(System.Web.Mvc.UrlHelper urlHelper)
 {
     return urlHelper.Action("Search", "User", new { Area = "Admin" });
 }
コード例 #4
0
		public override string Url(System.Web.Mvc.UrlHelper urlHelper) 
		{
			return urlHelper.Action(Action, Controller);
		}
コード例 #5
0
ファイル: ActivityForm.cs プロジェクト: Exclr8/CloudCore
 public override void InitializeSidebar(Sidebar sidebar, System.Web.Mvc.UrlHelper urlHelper)
 {
     sidebar.AddSidebarItem(SidebarObjectType.ViewDisplay, "Search", urlHelper.Action("Search", "Activity", new { area = "Admin" }));
     sidebar.AddSidebarItem(SidebarObjectType.ManageConfigure, "Access Pools", urlHelper.Action("AccessPoolAllocation", "Activity", new { area = "Admin", activityId = ActiveActivityDetails.ActivityId }));
     sidebar.AddSidebarItem(SidebarObjectType.ManageConfigure, "Automated Retries", urlHelper.Action("AutomatedRetries", "Activity", new { area = "Admin", activityId = ActiveActivityDetails.ActivityId }));
 }