Exemplo n.º 1
0
        public void ConfigureInterceptor()
        {
            var optionsBuilder = new RepositoryOptionsBuilder();

            Assert.False(optionsBuilder.IsConfigured);

            optionsBuilder.UseInterceptor(new TestRepositoryInterceptor("Random Param", false));

            Assert.True(optionsBuilder.IsConfigured);

            Assert.Single(optionsBuilder.Options.Interceptors);

            Assert.True(optionsBuilder.Options.Interceptors.ContainsKey(typeof(TestRepositoryInterceptor)));
        }
Exemplo n.º 2
0
        public void ConfigureMultipleInterceptorsOfDifferentType()
        {
            var optionsBuilder = new RepositoryOptionsBuilder();

            Assert.False(optionsBuilder.IsConfigured);

            optionsBuilder
            .UseInterceptor(new TestRepositoryInterceptor("Random Param", false))
            .UseInterceptor(new TestRepositoryInterceptor2());

            Assert.True(optionsBuilder.IsConfigured);

            Assert.Equal(2, optionsBuilder.Options.Interceptors.Count());

            Assert.True(optionsBuilder.Options.Interceptors.ContainsKey(typeof(TestRepositoryInterceptor)));
            Assert.True(optionsBuilder.Options.Interceptors.ContainsKey(typeof(TestRepositoryInterceptor2)));
        }