Ejemplo n.º 1
0
        public void SetUp()
        {
            var resolver = ObjectResolver.Basic();

            theSource   = new FolderAppSettingsXmlSource("Configuration");
            theProvider = new SettingsProvider(resolver, new ISettingsSource[] { theSource });
        }
        public void SetUp()
        {
            var resolver = ObjectResolver.Basic();

            _settingsSource = new TestSettingsSource();
            theProvider     = new SettingsProvider(resolver, new[] { _settingsSource });
        }
Ejemplo n.º 3
0
        public void SetUp()
        {
            theFile = "{0}.csv".ToFormat(GetType().Name);

            beforeEach();

            using (var writer = new StreamWriter(theFile))
            {
                writeFile(writer);
            }

            theReader = new CsvReader(ObjectResolver.Basic());

            theResults = new List <T>();

            theRequest = new CsvRequest <T>
            {
                Mapping  = new TMap(),
                FileName = theFile,
                Callback = theResults.Add
            };

            configureRequest(theRequest);

            theReader.Read(theRequest);
        }
        public void SetUp()
        {
            var json = "{Name:'Max', Age:8, Nested:{Order:5}, Array:[{Order:0}, {Order:1}, {Order:2}]}".Replace("'", "\"");

            var reader = new NewtonSoftBindingReader <JsonTarget>(null, ObjectResolver.Basic());

            theResult = reader.ReadFromJson(json);
        }
Ejemplo n.º 5
0
        public ParsingScenario(string fileName)
        {
            _fileName = fileName;
            _files    = new FileSystem();

            _parser = new ObjectBlockParser();

            _blockRegistry = BlockRegistry.Basic();
            _reader        = new ObjectBlockReader(_parser, ObjectResolver.Basic(), new InMemoryServiceLocator(), _blockRegistry);
        }
Ejemplo n.º 6
0
        public void Setup()
        {
            context = new InMemoryBindingContext();
            var objectResolver = ObjectResolver.Basic();

            context.RegisterService <IObjectResolver>(objectResolver);
            context.RegisterService <ISmartRequest>(new InMemorySmartRequest());
            context.RegisterService <IRequestData>(new InMemoryRequestData());

            propertyBinder = new CollectionPropertyBinder(new DefaultCollectionTypeProvider());
        }
        public void SetUp()
        {
            using (var writer = new StreamWriter("flatfile.txt"))
            {
                writer.WriteLine("A|B|C|D");
                writer.WriteLine("a0|b0|c0|d0");
                writer.WriteLine("a1|b1|c1|d1");
                writer.WriteLine("a2|b2|c2|d2");
            }

            reader = new FlatFileReader <FlatFileReaderTarget>(ObjectResolver.Basic(), new InMemoryServiceLocator());
        }
Ejemplo n.º 8
0
        public void settings_instance_works()
        {
            var container = new Container(x => {
                x.For <ISettingsSource>().Add <FakeSettingsData>();
                x.For <ISettingsProvider>().Use <SettingsProvider>();
                x.For <IObjectResolver>().Use(ObjectResolver.Basic());

                x.For <FooSettings>().UseInstance(new SettingsInstance <FooSettings>());
            });

            container.GetInstance <FooSettings>()
            .Name.ShouldBe("Max");
        }
Ejemplo n.º 9
0
 public static Container SetupContainerForFastPack()
 {
     return(new Container(x =>
     {
         x.For <IRepository>().Use <InMemoryRepository>();
         x.For <IEntityFinder>().Use <EntityFinder>();
         x.For <IEntityFinderCache>().Use <StructureMapEntityFinderCache>();
         x.For <ICurrentHttpRequest>().Use <FakeCurrentHttpRequest>();
         //x.For<IModelBinder>().Use(StandardModelBinder.Basic()); - dropped from fubucore 4/20/2012
         x.For <IObjectResolver>().Use(ObjectResolver.Basic());
         x.For <IEntityDefaults>().Use <NulloEntityDefaults>();
         x.For <IRequestData>().Use(new InMemoryRequestData());
     }));
 }
Ejemplo n.º 10
0
        private static object buildDefault(Type type)
        {
            if (type.IsValueType)
            {
                return(typeof(DefaultMaker <>).CloseAndBuildAs <IDefaultMaker>(type).Default());
            }

            if (type.IsConcreteWithDefaultCtor())
            {
                var provider = new AppSettingsProvider(ObjectResolver.Basic());
                return(provider.SettingsFor(type));
            }

            throw new ArgumentOutOfRangeException("Can only build default values for concrete classes with a default constructor and value types");
        }
Ejemplo n.º 11
0
        private void Load(Stream stream)
        {
            _list.Clear();

            var request = new CsvRequest <T>
            {
                HeadersExist      = false,
                UseHeaderOrdering = false,
                OpenStream        = () => stream,
                Mapping           = new TMap(),
                Callback          = (obj) => _list.Add(obj)
            };

            var reader = new CsvReader(ObjectResolver.Basic());

            reader.Read(request);
        }
Ejemplo n.º 12
0
        public static IContainer Bootstrap(DeploymentSettings settings)
        {
            return(new Container(x =>
            {
                // TODO -- might come back to this and make it smarter
                x.For <IObjectResolver>().Use(ObjectResolver.Basic());

                x.For <IFileSystem>().Use <FileSystem>();

                x.For <IProfileFinder>().Use <DeploymentFolderFinder>();
                x.For <IPackageExploder>().Use <PackageExploder>();
                x.For <IZipFileService>().Use <ZipFileService>();
                x.For <IPackageExploderLogger>().Use(new PackageExploderLogger(Console.WriteLine));

                x.For <DeploymentSettings>().Use(settings);

                x.AddRegistry <DeploymentRegistry>();
            }));
        }
Ejemplo n.º 13
0
        public void SetUp()
        {
            inMemoryServiceLocator = new InMemoryServiceLocator();

            _binder = new EditEntityModelBinder(new NulloEntityDefaults());

            theGuid = Guid.NewGuid();

            theData            = new InMemoryRequestData();
            theData["BobName"] = "Ryan";
            theData["Flavor"]  = "choco";
            theData["Id"]      = theGuid.ToString();

            cl = new ConverterLibrary();

            oc = new ObjectConverter(inMemoryServiceLocator, cl);

            inMemoryServiceLocator.Add <IObjectConverter>(oc);

            inMemoryServiceLocator.Add <IObjectResolver>(ObjectResolver.Basic());
        }
 public void SetUp()
 {
     resolver = ObjectResolver.Basic();
     data     = new InMemoryRequestData();
 }
Ejemplo n.º 15
0
 public static ObjectBlockReader Basic(BlockRegistry registry)
 {
     return(new ObjectBlockReader(new ObjectBlockParser(), ObjectResolver.Basic(), new InMemoryServiceLocator(), registry));
 }
Ejemplo n.º 16
0
 public AppSettingProviderRegistry()
 {
     For <ISettingsProvider>().Use <AppSettingsProvider>();
     For <IObjectResolver>().Use(x => ObjectResolver.Basic());
 }
Ejemplo n.º 17
0
 public void SetUp()
 {
     binder = new ReaderBinder(ObjectResolver.Basic(), new InMemoryServiceLocator());
 }
 public void SetUp()
 {
     theObjectResolver = ObjectResolver.Basic();
     theResolver       = new ValidationTargetResolver(theObjectResolver);
 }
Ejemplo n.º 19
0
        public void SetUp()
        {
            theSource = new CentralizedSettingsSource("Configuration");

            theProvider = new SettingsProvider(ObjectResolver.Basic(), theSource.FindSettingData());
        }
Ejemplo n.º 20
0
 public void SetUp()
 {
     theSettings = new AppSettingsProvider(ObjectResolver.Basic())
                   .SettingsFor <AppSettings>();
 }
Ejemplo n.º 21
0
 public static SettingsProvider For(params SettingsData[] data)
 {
     return(new SettingsProvider(ObjectResolver.Basic(), data));
 }