예제 #1
0
    public BuilderSetup DoSetup()
    {
        BuilderSetup builderSetup = new BuilderSetup();

        EnsureActiveRecordInitialized();

        if (setup)
        {
            return(builderSetup);
        }

        setup = true;

        var productRepository  = Dependency.Resolve <IProductRepository>();
        var taxTypeRepository  = Dependency.Resolve <ITaxTypeRepository>();
        var categoryRepository = Dependency.Resolve <ICategoryRepository>();

        builderSetup.SetCreatePersistenceMethod <Product>(productRepository.Create);
        builderSetup.SetCreatePersistenceMethod <IList <Product> >(productRepository.CreateAll);
        builderSetup.SetCreatePersistenceMethod <TaxType>(taxTypeRepository.Create);
        builderSetup.SetCreatePersistenceMethod <IList <TaxType> >(taxTypeRepository.CreateAll);
        builderSetup.SetCreatePersistenceMethod <Category>(categoryRepository.Create);
        builderSetup.SetCreatePersistenceMethod <IList <Category> >(categoryRepository.CreateAll);
        builderSetup.SetUpdatePersistenceMethod <Category>(categoryRepository.Save);
        builderSetup.SetUpdatePersistenceMethod <IList <Category> >(categoryRepository.SaveAll);
        return(builderSetup);
    }
예제 #2
0
        public void ShouldBeAbleToSetUpdatePersistenceMethod()
        {
            Action <MyClass> func = x => repository.Save(x);

            using (mocks.Record())
            {
                persistenceService.Expect(x => x.SetPersistenceUpdateMethod(func));
            }

            builderSetup.SetUpdatePersistenceMethod <MyClass>(func);
        }
예제 #3
0
    public BuilderSetup DoSetup()
    {
        BuilderSetup builderSetup = new BuilderSetup();
        EnsureActiveRecordInitialized();

        if (setup)
            return builderSetup;

        setup = true;

        var productRepository = Dependency.Resolve<IProductRepository>();
        var taxTypeRepository = Dependency.Resolve<ITaxTypeRepository>();
        var categoryRepository = Dependency.Resolve<ICategoryRepository>();

        builderSetup.SetCreatePersistenceMethod<Product>(productRepository.Create);
        builderSetup.SetCreatePersistenceMethod<IList<Product>>(productRepository.CreateAll);
        builderSetup.SetCreatePersistenceMethod<TaxType>(taxTypeRepository.Create);
        builderSetup.SetCreatePersistenceMethod<IList<TaxType>>(taxTypeRepository.CreateAll);
        builderSetup.SetCreatePersistenceMethod<Category>(categoryRepository.Create);
        builderSetup.SetCreatePersistenceMethod<IList<Category>>(categoryRepository.CreateAll);
        builderSetup.SetUpdatePersistenceMethod<Category>(categoryRepository.Save);
        builderSetup.SetUpdatePersistenceMethod<IList<Category>>(categoryRepository.SaveAll);
        return builderSetup;
    }