Reacting to DI changes
This commit is contained in:
parent
82574ce6cc
commit
39d9303769
|
|
@ -269,7 +269,7 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests
|
||||||
|
|
||||||
var optionsBuilder = new DbContextOptionsBuilder();
|
var optionsBuilder = new DbContextOptionsBuilder();
|
||||||
optionsBuilder.UseSqlServer(database.ConnectionString);
|
optionsBuilder.UseSqlServer(database.ConnectionString);
|
||||||
services.AddInstance<DbContextOptions>(optionsBuilder.Options);
|
services.AddSingleton<DbContextOptions>(optionsBuilder.Options);
|
||||||
});
|
});
|
||||||
|
|
||||||
HttpResponseMessage response = await server.CreateClient().GetAsync("http://localhost/");
|
HttpResponseMessage response = await server.CreateClient().GetAsync("http://localhost/");
|
||||||
|
|
@ -307,7 +307,7 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests
|
||||||
{
|
{
|
||||||
optionsBuilder.UseInMemoryDatabase();
|
optionsBuilder.UseInMemoryDatabase();
|
||||||
}
|
}
|
||||||
services.AddInstance<DbContextOptions>(optionsBuilder.Options);
|
services.AddSingleton<DbContextOptions>(optionsBuilder.Options);
|
||||||
});
|
});
|
||||||
|
|
||||||
var ex = await Assert.ThrowsAsync<SqlException>(async () =>
|
var ex = await Assert.ThrowsAsync<SqlException>(async () =>
|
||||||
|
|
@ -431,7 +431,7 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests
|
||||||
{
|
{
|
||||||
optionsBuilder.UseInMemoryDatabase();
|
optionsBuilder.UseInMemoryDatabase();
|
||||||
}
|
}
|
||||||
services.AddInstance(optionsBuilder.Options);
|
services.AddSingleton(optionsBuilder.Options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests
|
||||||
{
|
{
|
||||||
services.AddEntityFramework().AddSqlServer();
|
services.AddEntityFramework().AddSqlServer();
|
||||||
services.AddScoped<BloggingContextWithMigrations>();
|
services.AddScoped<BloggingContextWithMigrations>();
|
||||||
services.AddInstance(optionsBuilder.Options);
|
services.AddSingleton(optionsBuilder.Options);
|
||||||
});
|
});
|
||||||
|
|
||||||
using (var db = BloggingContextWithMigrations.CreateWithoutExternalServiceProvider(optionsBuilder.Options))
|
using (var db = BloggingContextWithMigrations.CreateWithoutExternalServiceProvider(optionsBuilder.Options))
|
||||||
|
|
@ -190,7 +190,7 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Tests
|
||||||
{
|
{
|
||||||
services.AddEntityFramework().AddSqlServer();
|
services.AddEntityFramework().AddSqlServer();
|
||||||
services.AddScoped<BloggingContextWithSnapshotThatThrows>();
|
services.AddScoped<BloggingContextWithSnapshotThatThrows>();
|
||||||
services.AddInstance(optionsBuilder.Options);
|
services.AddSingleton(optionsBuilder.Options);
|
||||||
});
|
});
|
||||||
|
|
||||||
var formData = new FormUrlEncodedContent(new List<KeyValuePair<string, string>>
|
var formData = new FormUrlEncodedContent(new List<KeyValuePair<string, string>>
|
||||||
|
|
|
||||||
|
|
@ -204,9 +204,9 @@ namespace Microsoft.AspNet.Diagnostics.Tests
|
||||||
.Returns(responseStream);
|
.Returns(responseStream);
|
||||||
contextMock
|
contextMock
|
||||||
.SetupGet(c => c.ApplicationServices)
|
.SetupGet(c => c.ApplicationServices)
|
||||||
.Returns(new ServiceCollection().
|
.Returns(new ServiceCollection()
|
||||||
AddInstance<HtmlEncoder>(new HtmlTestEncoder()).
|
.AddSingleton<HtmlEncoder>(new HtmlTestEncoder())
|
||||||
BuildServiceProvider());
|
.BuildServiceProvider());
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await middleware.Invoke(contextMock.Object);
|
await middleware.Invoke(contextMock.Object);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue