public void ThrowIfContextIsNotHttpContext() { var context = new Object(); var strategy = new RouteMultiTenantStrategy("__tenant__"); Assert.Throws <MultiTenantException>(() => strategy.GetIdentifier(context)); }
public void ReturnNullIfNoRouteData() { var httpContext = CreateHttpContextMockWithNoRouteData(); var strategy = new RouteMultiTenantStrategy("__tenant__"); var identifier = strategy.GetIdentifier(httpContext); Assert.Null(identifier); }
public void ReturnNullIfNoRouteParamMatch() { var httpContext = CreateHttpContextMock("__tenant__", "initech"); var strategy = new RouteMultiTenantStrategy("controller"); var identifier = strategy.GetIdentifier(httpContext); Assert.Null(identifier); }
[InlineData("__tenant__", "Initech", "Initech")] // maintain case public void ReturnExpectedIdentifier(string tenantParam, string routeValue, string expected) { var httpContext = CreateHttpContextMock(tenantParam, routeValue); var strategy = new RouteMultiTenantStrategy(tenantParam); var identifier = strategy.GetIdentifier(httpContext); Assert.Equal(expected, identifier); }