public void DisplayNameTest() { Assert.AreEqual("DbRecord", GetMember.DisplayName <CountryObject>(o => o.DbRecord)); Assert.AreEqual("Valid From", GetMember.DisplayName <CountryViewModel>(o => o.ValidFrom)); Assert.AreEqual("Name", GetMember.DisplayName <CountryViewModel>(o => o.Name)); Assert.AreEqual("Valid To", GetMember.DisplayName <CountryViewModel>(o => o.ValidTo)); Assert.AreEqual(string.Empty, GetMember.DisplayName <CountryViewModel>(null)); }
public void DisplayNameTest() { Assert.AreEqual("DbRecord", GetMember.DisplayName <CountryObject>(o => o.DbRecord)); Assert.AreEqual("Valid From", GetMember.DisplayName <CountryViewModel>(o => o.ValidFrom)); Assert.AreEqual("Name", GetMember.DisplayName <CountryViewModel>(o => o.Name)); Assert.AreEqual("Valid To", GetMember.DisplayName <CountryViewModel>(o => o.ValidTo)); Assert.AreEqual(string.Empty, GetMember.DisplayName <CountryViewModel>(null)); // Impossible to use for methods // Assert.AreEqual(string.Empty, GetMember.DisplayName<GetMemberTests>(o => o.NameTest())); }
[TestMethod] public void DisplayNameTest() { Assert.AreEqual("Data", GetMember.DisplayName <Account>(o => o.Data)); Assert.AreEqual("Valid From", GetMember.DisplayName <AccountView>(o => o.ValidFrom)); Assert.AreEqual("Balance", GetMember.DisplayName <AccountView>(o => o.Balance)); Assert.AreEqual("Valid To", GetMember.DisplayName <AccountView>(o => o.ValidTo)); Assert.AreEqual(string.Empty, GetMember.DisplayName <AccountView>(null)); //Impossible to use for methods //Assert.AreEqual(string.Empty, GetMember.DisplayName<GetMemberTests>(o => o.NameTest())); }
public void DisplayNameTest() { Assert.AreEqual("DbRecord", GetMember.DisplayName <ProfileObject>(o => o.DbRecord)); Assert.AreEqual("BirthDay", GetMember.DisplayName <ProfileViewModel>(o => o.BirthDay)); Assert.AreEqual("Name", GetMember.DisplayName <ProfileViewModel>(o => o.Name)); Assert.AreEqual("Gender", GetMember.DisplayName <ProfileViewModel>(o => o.Gender)); Assert.AreEqual("Location", GetMember.DisplayName <ProfileViewModel>(o => o.Location)); Assert.AreEqual("Little bit about Me:", GetMember.DisplayName <ProfileViewModel>(o => o.AboutText)); Assert.AreEqual("Occupation", GetMember.DisplayName <ProfileViewModel>(o => o.Occupation)); Assert.AreEqual(string.Empty, GetMember.DisplayName <ProfileViewModel>(null)); }
[TestMethod] public void DisplayNameTest() { Assert.AreEqual("DbRecord", GetMember.DisplayName <BidObject>(o => o.DbRecord)); Assert.AreEqual("Valid From", GetMember.DisplayName <BidViewModel>(o => o.ValidFrom)); Assert.AreEqual("User ID", GetMember.DisplayName <BidViewModel>(o => o.UserId)); Assert.AreEqual("Price", GetMember.DisplayName <BidViewModel>(o => o.Price)); Assert.AreEqual("Valid To", GetMember.DisplayName <BidViewModel>(o => o.ValidTo)); Assert.AreEqual(string.Empty, GetMember.DisplayName <BidViewModel>(null)); //Impossible to use for methods //Assert.AreEqual(string.Empty, GetMember.DisplayName<GetMemberTests>(o => o.NameTest())); }
internal static IList <object> createString <TModel, TResult>(IHtmlHelper <TModel> htmlHelper, Expression <Func <TModel, IList <TResult> > > expression, Expression <Func <TResult, object> >[] properties) where TModel : PageModel { var htmlStrings = new List <object>(); var f = expression.Compile(); var items = f(htmlHelper.ViewData.Model); if (items.Count > 0) { htmlStrings.Add(new HtmlString("<dt class=\"col-sm-2\">")); htmlStrings.Add(htmlHelper.DisplayNameFor(expression)); htmlStrings.Add(new HtmlString("</dt>")); htmlStrings.Add(new HtmlString("<p />")); htmlStrings.Add(new HtmlString("<dd class=\"col-sm-10\">")); htmlStrings.Add(new HtmlString("<table class=\"table\">")); htmlStrings.Add(new HtmlString("<thead>")); htmlStrings.Add(new HtmlString("<tr>")); foreach (var p in properties) { htmlStrings.Add(new HtmlString("<th>")); htmlStrings.Add(GetMember.DisplayName(p)); htmlStrings.Add(new HtmlString("</th>")); } htmlStrings.Add(new HtmlString("</tr>")); htmlStrings.Add(new HtmlString("</thead>")); htmlStrings.Add(new HtmlString("<tbody>")); foreach (var e in items) { htmlStrings.Add(new HtmlString("<tr>")); foreach (var p in properties) { htmlStrings.Add(new HtmlString("<td>")); var x = p.Compile(); htmlStrings.Add(x(e).ToString()); htmlStrings.Add(new HtmlString("</td>")); } htmlStrings.Add(new HtmlString("</tr>")); } htmlStrings.Add(new HtmlString("</tbody>")); htmlStrings.Add(new HtmlString("</table>")); htmlStrings.Add(new HtmlString("</dd>")); } return(htmlStrings); }
private static string idIsInUseMessage(string id) { var name = GetMember.DisplayName <GoodView>(c => c.Code); return(string.Format(Messages.ValueIsAlreadyInUse, id, name)); }
private static string idIsInUseMessage(string id) { var name = GetMember.DisplayName <CountryViewModel>(c => c.Alpha3Code); return(string.Format(Messages.ValueIsAlreadyInUse, id, name)); }
public void DisplayNameTest() { Assert.AreEqual("Name", GetMember.DisplayName <CoachView>(o => o.Name)); Assert.AreEqual(string.Empty, GetMember.DisplayName <CoachView>(null)); }
private static string idIsInUseMessage(string id) { var name = GetMember.DisplayName <CurrencyViewModel>(c => c.IsoCurrencySymbol); return(string.Format(Messages.ValueIsAlreadyInUse, id, name)); }
public void DisplayNameTest() { Assert.AreEqual("Company", GetMember.DisplayName <FlightView>(o => o.Company)); Assert.AreEqual(string.Empty, GetMember.DisplayName <FlightView>(null)); }