//Summary to test message header is getting correctly set public void Test_Get_Context_FromMessageHeader_ForContextKeyNotPresent() { IContextHeaders contextMiddleware = new MiddlewareContextHeaders(_contextAccessors); var headers = new Headers(); var tenantExists = contextMiddleware.TryGetContext(ContextKey, headers, out var context); Assert.False(tenantExists); }
//Summary to test message header is getting correctly set public void Test_Get_Context_FromMessageHeader_ForInvalidTenant_ContextNull() { IContextHeaders contextMiddleware = new MiddlewareContextHeaders(_contextAccessors); var headers = new Headers(); var tenantExists = contextMiddleware.TryGetContext(ContextKey, headers, out var context); Assert.Equal(default(Context.Context), context); }
//Summary to test message header is getting correctly set public void Test_Get_Context_FromMessageHeader(string tenantKey) { IContextHeaders contextMiddleware = new MiddlewareContextHeaders(_contextAccessors); var headers = new Headers(); headers.Add(ContextKey, ObjectToByteArray(_contextAccessors.Current)); contextMiddleware.TryGetContext(ContextKey, headers, out var context); Assert.Equal(tenantKey, context.Tenant.TenantKey); }