Пример #1
0
        public void AllowsCreatingContextWithoutSettingAccessor()
        {
            // Arrange
            var contextFactory = new ProtoContextFactory(Options.Create(new FormOptions()), new MyServiceScopeFactory());

            // Act & Assert
            var context = contextFactory.Create(new FeatureCollection());

            contextFactory.Dispose(context);
        }
Пример #2
0
        public void CreateProtoContextSetsProtoContextAccessor()
        {
            // Arrange
            var accessor       = new ProtoContextAccessor();
            var contextFactory = new ProtoContextFactory(Options.Create(new FormOptions()), new MyServiceScopeFactory(), accessor);

            // Act
            var context = contextFactory.Create(new FeatureCollection());

            // Assert
            Assert.Same(context, accessor.ProtoContext);
        }