public void AllMethodsShoulReturnMethodsHavingTheCheckBoxName() { IEnumerable <MethodInfo> all = new TestHtmlTag().AllMethods; Assert.That(all.Count(), Is.GreaterThan(0)); Assert.That(all.All(m => m.Name.Equals("CheckBox"))); }
public void SearchingOnCandidatesShouldBeCaseInsensitive() { IEnumerable <MethodInfo> candidates = GetCandidates("ISCHECKED"); List <MethodInfo> all = new TestHtmlTag().AllMethods.ToList(); Assert.That(candidates.Count(), Is.GreaterThan(0)); Assert.That(candidates.All(m => m.Name.Equals("CheckBox"))); foreach (MethodInfo info in candidates) { Assert.That(all, Has.Member(info)); Assert.That(info.GetParameters().Any(p => p.Name.Equals("isChecked"))); } }
public void AllCandidatesShoulReturnMethodsHavingTheExpectedParams() { var candidates = GetCandidates("isChecked", "name"); var all = new TestHtmlTag().AllMethods.ToList(); Assert.That(candidates.Count(), Is.GreaterThan(0)); Assert.That(candidates.All(m => m.Name.Equals("CheckBox"))); foreach (MethodInfo info in candidates) { Assert.That(all, Has.Member(info)); Assert.That(info.GetParameters().Any(p => p.Name.Equals("isChecked"))); } }
public void AllCandidatesShoulReturnAllMethodsIfNoParametersAreGiven() { IEnumerable<MethodInfo> candidates = GetCandidates(); Assert.That(candidates.Count(), Is.GreaterThan(0)); Assert.That(candidates.All(m => m.Name.Equals("CheckBox"))); IEnumerable<MethodInfo> all = new TestHtmlTag().AllMethods; Assert.That(candidates.Count(), Is.EqualTo(all.Count())); foreach (MethodInfo info in all) { Assert.That(candidates, Has.Member(info)); } }
public void AllCandidatesShoulReturnAllMethodsIfNoParametersAreGiven() { IEnumerable <MethodInfo> candidates = GetCandidates(); Assert.That(candidates.Count(), Is.GreaterThan(0)); Assert.That(candidates.All(m => m.Name.Equals("CheckBox"))); IEnumerable <MethodInfo> all = new TestHtmlTag().AllMethods; Assert.That(candidates.Count(), Is.EqualTo(all.Count())); foreach (MethodInfo info in all) { Assert.That(candidates, Has.Member(info)); } }
public void AssembleParametersShouldCorrectlyBuildParameterArray() { var tag = new TestHtmlTag { Parameters = new List <IParameterValue> { new TestParameterValue { Name = "isChecked", TestValue = true }, new TestParameterValue { Name = "name", TestValue = "flag" } } }; MethodInfo method = tag.Method; object[] values = tag.AssembleParameters(method, GetHelper(), null); CheckParameters(method, values); }
public void AssembleParametersShouldCorrectlyBuildParameterArrayMissingRequiredArgument() { var tag = new TestHtmlTag { Parameters = new List <IParameterValue> { new TestParameterValue { Name = "isChecked", TestValue = true } } }; try { tag.AssembleParameters(tag.Method, GetHelper(), null); Assert.Fail("Expected exception"); } catch (HtmlHelperTagException HHTe) { Assert.That(HHTe.Message, Is.EqualTo(HtmlHelperTagException.RequiredArgumentMissing("name", tag.Method).Message)); } }
public void AllCandidatesShoulReturnMethodsHavingTheExpectedParam() { IEnumerable<MethodInfo> candidates = GetCandidates("isChecked"); List<MethodInfo> all = new TestHtmlTag().AllMethods.ToList(); Assert.That(candidates.Count(), Is.GreaterThan(0)); Assert.That(candidates.All(m => m.Name.Equals("CheckBox"))); foreach (MethodInfo info in candidates) { Assert.That(all, Has.Member(info)); Assert.That(info.GetParameters().Any(p => p.Name.Equals("isChecked"))); } }
public void SearchingOnCandidatesShouldBeCaseInsensitive() { IEnumerable<MethodInfo> candidates = GetCandidates("ISCHECKED"); List<MethodInfo> all = new TestHtmlTag().AllMethods.ToList(); Assert.That(candidates.Count(), Is.GreaterThan(0)); Assert.That(candidates.All(m => m.Name.Equals("CheckBox"))); foreach (MethodInfo info in candidates) { Assert.That(all, Has.Member(info)); Assert.That(info.GetParameters().Any(p => p.Name.Equals("isChecked"))); } }
public void AssembleParametersShouldCorrectlyBuildParameterArrayMissingRequiredArgument() { var tag = new TestHtmlTag { Parameters = new List<IParameterValue> { new TestParameterValue {Name = "isChecked", TestValue = true} } }; try { tag.AssembleParameters(tag.Method, GetHelper(), null); Assert.Fail("Expected exception"); } catch (HtmlHelperTagException HHTe) { Assert.That(HHTe.Message, Is.EqualTo(HtmlHelperTagException.RequiredArgumentMissing("name", tag.Method).Message)); } }
public void AssembleParametersShouldCorrectlyBuildParameterArray() { var tag = new TestHtmlTag { Parameters = new List<IParameterValue> { new TestParameterValue {Name = "isChecked", TestValue = true}, new TestParameterValue {Name = "name", TestValue = "flag"} } }; MethodInfo method = tag.Method; object[] values = tag.AssembleParameters(method, GetHelper(), null); CheckParameters(method, values); }
public void AllMethodsShoulReturnMethodsHavingTheCheckBoxName() { IEnumerable<MethodInfo> all = new TestHtmlTag().AllMethods; Assert.That(all.Count(), Is.GreaterThan(0)); Assert.That(all.All(m => m.Name.Equals("CheckBox"))); }