예제 #1
0
    public void OwinEnvironmentSuppliesDefaultsForMissingRequiredEntries()
    {
        HttpContext context = CreateContext();
        IDictionary <string, object> env = new OwinEnvironment(context);

        object value;

        Assert.True(env.TryGetValue("owin.CallCancelled", out value), "owin.CallCancelled");
        Assert.True(env.TryGetValue("owin.Version", out value), "owin.Version");

        Assert.Equal(CancellationToken.None, env["owin.CallCancelled"]);
        Assert.Equal("1.0", env["owin.Version"]);
    }
예제 #2
0
    public void OwinEnvironmentDoesNotContainEntriesForMissingFeatures(string key)
    {
        HttpContext context = CreateContext();
        IDictionary <string, object> env = new OwinEnvironment(context);

        object value;

        Assert.False(env.TryGetValue(key, out value));

        Assert.Throws <KeyNotFoundException>(() => env[key]);

        Assert.False(env.Keys.Contains(key));
        Assert.False(env.ContainsKey(key));
    }