public void Must_add_restrictions(Type type, string methodName) { MethodInfo methodInfo = type.GetMethod(methodName); _mapper.MapAsync(type, methodInfo, _route, _container); IEnumerable <MethodRestriction> restrictions = _route.GetRestrictions <MethodRestriction>(); Assert.That(restrictions, Is.Empty); }
public void Must_add_restriction() { _attribute.Map(_route, _container); UrlFragmentRestriction[] restrictions = _route.GetRestrictions <UrlFragmentRestriction>().ToArray(); Assert.That(restrictions, Has.Length.EqualTo(1)); Assert.That(restrictions[0].Fragment, Is.EqualTo("fragment")); Assert.That(restrictions[0].Comparer, Is.SameAs(CaseSensitiveRegexComparer.Instance)); }
public void Must_add_restriction() { _attribute.Map(_route, _container); RefererUrlAbsolutePathRestriction[] restrictions = _route.GetRestrictions <RefererUrlAbsolutePathRestriction>().ToArray(); Assert.That(restrictions, Has.Length.EqualTo(1)); Assert.That(restrictions[0].AbsolutePath, Is.EqualTo("path")); Assert.That(restrictions[0].Comparer, Is.SameAs(CaseSensitiveRegexComparer.Instance)); }
public void Must_add_restrictions() { _attribute.Map(_route, _container); UrlPortRestriction[] restrictions = _route.GetRestrictions <UrlPortRestriction>().ToArray(); Assert.That(restrictions, Has.Length.EqualTo(2)); Assert.That(restrictions[0].Port, Is.EqualTo(8080)); Assert.That(restrictions[1].Port, Is.EqualTo(16000)); }
public void Must_add_restriction() { _attribute.Map(_route, _container); HeaderRestriction[] restrictions = _route.GetRestrictions <HeaderRestriction>().ToArray(); Assert.That(restrictions, Has.Length.EqualTo(1)); Assert.That(restrictions[0].Field, Is.EqualTo("field")); Assert.That(restrictions[0].Value, Is.EqualTo("value")); Assert.That(restrictions[0].ValueComparer, Is.SameAs(CaseInsensitivePlainComparer.Instance)); }
public void Must_add_restrictions() { _attribute.Map(_route, _container); MethodRestriction[] restrictions = _route.GetRestrictions <MethodRestriction>().ToArray(); Assert.That(restrictions, Has.Length.EqualTo(2)); Assert.That(restrictions[0].Method, Is.EqualTo("GET")); Assert.That(restrictions[1].Method, Is.EqualTo("POST")); }
public void Must_add_restrictions(Type type, string methodName, string expectedMethod) { MethodInfo methodInfo = type.GetMethod(methodName); _mapper.MapAsync(type, methodInfo, _route, _container); MethodRestriction[] restrictions = _route.GetRestrictions <MethodRestriction>().ToArray(); Assert.That(restrictions, Has.Length.EqualTo(1)); Assert.That(restrictions[0].Method, Is.EqualTo(expectedMethod).Using((IComparer)StringComparer.OrdinalIgnoreCase)); }
public void Must_add_restrictions() { _attribute.Map(_route, _container); RefererUrlHostTypeRestriction[] restrictions = _route.GetRestrictions <RefererUrlHostTypeRestriction>().ToArray(); Assert.That(restrictions, Has.Length.EqualTo(2)); Assert.That(restrictions[0].Type, Is.EqualTo(UriHostNameType.Basic)); Assert.That(restrictions[1].Type, Is.EqualTo(UriHostNameType.Dns)); }
public void Must_add_restriction() { _attribute.Map(_route, _container); CookieRestriction[] restrictions = _route.GetRestrictions <CookieRestriction>().ToArray(); Assert.That(restrictions, Has.Length.EqualTo(1)); Assert.That(restrictions[0].Name, Is.EqualTo("name")); Assert.That(restrictions[0].NameComparer, Is.SameAs(CaseSensitiveRegexComparer.Instance)); Assert.That(restrictions[0].Value, Is.EqualTo("value")); Assert.That(restrictions[0].ValueComparer, Is.SameAs(CaseInsensitiveRegexComparer.Instance)); }
public void Must_add_restrictions() { _attribute.Map(_route, _container); UrlRelativePathRestriction[] restrictions = _route.GetRestrictions <UrlRelativePathRestriction>().ToArray(); Assert.That(restrictions, Has.Length.EqualTo(2)); Assert.That(restrictions[0].RelativePath, Is.EqualTo("relative1")); Assert.That(restrictions[0].Comparer, Is.SameAs(CaseInsensitivePlainComparer.Instance)); Assert.That(restrictions[1].RelativePath, Is.EqualTo("relative2")); Assert.That(restrictions[1].Comparer, Is.SameAs(CaseInsensitivePlainComparer.Instance)); }
public void Must_add_restrictions(Type type, string methodName, bool makeLowercase, string wordSeparator, string expectedUrlRelativePath) { MethodInfo methodInfo = type.GetMethod(methodName); var mapper = new UrlRelativePathFromRelativeClassNamespaceAndClassNameMapper("Junior.Route.UnitTests", true, makeLowercase, wordSeparator); mapper.MapAsync(type, methodInfo, _route, _container); UrlRelativePathRestriction[] restrictions = _route.GetRestrictions <UrlRelativePathRestriction>().ToArray(); Assert.That(restrictions, Has.Length.EqualTo(1)); Assert.That(restrictions[0].Comparer, Is.SameAs(CaseSensitivePlainComparer.Instance)); Assert.That(restrictions[0].RelativePath, Is.EqualTo(expectedUrlRelativePath)); }
public void Must_add_restrictions() { _attribute.Map(_route, _container); RefererUrlQueryRestriction[] restrictions = _route.GetRestrictions <RefererUrlQueryRestriction>().ToArray(); Assert.That(restrictions, Has.Length.EqualTo(2)); Assert.That(restrictions[0].Query, Is.EqualTo("query1")); Assert.That(restrictions[0].Comparer, Is.SameAs(CaseInsensitivePlainComparer.Instance)); Assert.That(restrictions[1].Query, Is.EqualTo("query2")); Assert.That(restrictions[1].Comparer, Is.SameAs(CaseInsensitivePlainComparer.Instance)); }