示例#1
0
        public async Task DbContextWithDependency_DependencyByNameSpecified_ContextCreated()
        {
            var dependency1     = new Dependency();
            var dependency2     = new Dependency();
            var databaseFixture = new DatabaseFixture <HasDuplicateTypeDependencies>();

            databaseFixture.AddDependency <IDependency>(dependency1, "dependency1");
            databaseFixture.AddDependency <IDependency>(dependency2, "dependency2");

            await databaseFixture.PerformDatabaseOperation(context =>
            {
                Assert.Equal(dependency1, context.Dependency1);
                Assert.Equal(dependency2, context.Dependency2);
            });
        }
示例#2
0
        public async Task DbContextWithDependency_DependencyByTypeSpecified_ContextCreated()
        {
            var dependency      = new Dependency();
            var databaseFixture = new DatabaseFixture <DbContextWithDependency>();

            databaseFixture.AddDependency <IDependency>(dependency);

            await databaseFixture.PerformDatabaseOperation(context =>
            {
                Assert.Equal(dependency, context.MyDependency);
            });
        }