Пример #1
0
 private void AssumeStatementFactoryProviderIsInitialised()
 {
     this.statementFactoryProvider = Substitute.For <IStatementFactoryProvider>();
     this.statementFactory         = Substitute.For <IStatementFactory>();
     this.statementFactoryProvider.Provide()
     .Returns(this.statementFactory);
 }
Пример #2
0
 public DefaultRouteBuilder(
     IStatementFactory statementFactory,
     IRouteGraphBuilder graphBuilder)
 {
     _statementFactory = statementFactory ?? throw new ArgumentNullException(nameof(statementFactory));
     _graphBuilder     = graphBuilder ?? throw new ArgumentNullException(nameof(graphBuilder));
 }
Пример #3
0
 public AccountService(IAccountFactory accountFactory, IAmountFactory amountFactory, IStatementCollectionFactory statementCollectionFactory, IStatementFactory statementFactory)
 {
     _accountFactory             = accountFactory ?? throw new ArgumentNullException(nameof(accountFactory));
     _amountFactory              = amountFactory ?? throw new ArgumentNullException(nameof(amountFactory));
     _statementCollectionFactory = statementCollectionFactory ?? throw new ArgumentNullException(nameof(statementCollectionFactory));
     _statementFactory           = statementFactory ?? throw new ArgumentNullException(nameof(statementFactory));
 }
Пример #4
0
        public void ParserShouldCallStatementFactoryAndContextManagerWhenParsingTokens()
        {
            IList <TokenBase> input = new List <TokenBase>();

            input.Add(TokenCreator.Create <GenericToken>("source", null));
            input.Add(TokenCreator.Create <GenericToken>("code", null));

            IStatementFactory        factory        = Mocker.StrictMock <IStatementFactory>();
            IStatementContext        context        = Mocker.StrictMock <IStatementContext>();
            IStatementContextManager contextManager = Mocker.StrictMock <IStatementContextManager>();

            Expect.Call(factory.CanCreateStatementFrom(new List <TokenBase>(), context)).IgnoreArguments().Return(true).Repeat.Once();
            Expect.Call(factory.Create(input, context)).Return(new GenericStatement(input, context)).Repeat.Once();
            Expect.Call(() => contextManager.Encountered(new[] { new GenericStatement(input, context) }, input.Count, input)).Repeat.Once();
            Expect.Call(contextManager.GetContext(input)).Return(context).Repeat.Once();

            input.Add(TokenCreator.Create <SemiColonToken>());

            StubStatementFactoryProvider provider = new StubStatementFactoryProvider(factory);
            CalidusStatementParser       parser   = new CalidusStatementParser(provider, contextManager);

            Mocker.ReplayAll();

            parser.Parse(input);

            Mocker.VerifyAll();
        }
 public TypescriptNamespace(
     IStatementFactory statementFactory,
     IMemberFactory memberFactory)
 {
     _statementFactory = statementFactory;
     _memberFactory    = memberFactory;
     System.Diagnostics.Debug.WriteLine("Typescriptnamespace Created");
 }
 public TypescriptNamespace(
     IStatementFactory statementFactory,
     IMemberFactory memberFactory)
 {
     _statementFactory = statementFactory;
     _memberFactory = memberFactory;
     System.Diagnostics.Debug.WriteLine("Typescriptnamespace Created");
 }
Пример #7
0
 public StatementService(
     IStatementFactory statementFactory,
     IStatementRepository statementRepository,
     IUnitOfWork unitOfWork)
 {
     this.statementRepository = statementRepository;
     this.statementFactory    = statementFactory;
     this.unitOfWork          = unitOfWork;
 }
Пример #8
0
        public DefaultRouteBuilderTest()
        {
            _fixture = new Fixture();

            _statementFactory = Substitute.For <IStatementFactory>();
            _graphBuilder     = Substitute.For <IRouteGraphBuilder>();

            _builder = new DefaultRouteBuilder(_statementFactory,
                                               _graphBuilder);
        }
 public TypescriptConstructor(
     IExpressionFactory expressionFactory,
     IStatementFactory statementFactory,
     CodeConstructor member,
     CodeGeneratorOptions options)
 {
     _expressionFactory = expressionFactory;
     _statementFactory = statementFactory;
     _member = member;
     _options = options;
 }
 public TypescriptConstructor(
     IExpressionFactory expressionFactory,
     IStatementFactory statementFactory,
     CodeConstructor member,
     CodeGeneratorOptions options)
 {
     _expressionFactory = expressionFactory;
     _statementFactory  = statementFactory;
     _member            = member;
     _options           = options;
 }
Пример #11
0
 public TypescriptRemoveEventStatement(
     IStatementFactory statementFactory,
     IExpressionFactory expressionFactory,
     CodeRemoveEventStatement statement,
     CodeGeneratorOptions options)
 {
     _statementFactory  = statementFactory;
     _expressionFactory = expressionFactory;
     _statement         = statement;
     _options           = options;
 }
 public TypescriptMethodReturnStatement(
     IStatementFactory statementFactory,
     IExpressionFactory expressionFactory,
     CodeMethodReturnStatement statement,
     CodeGeneratorOptions options)
 {
     _statementFactory  = statementFactory;
     _expressionFactory = expressionFactory;
     _statement         = statement;
     _options           = options;
 }
 public TypescriptGotoStatement(
     IStatementFactory statementFactory,
     IExpressionFactory expressionFactory,
     CodeGotoStatement statement,
     CodeGeneratorOptions options)
 {
     _statementFactory = statementFactory;
     _expressionFactory = expressionFactory;
     _statement = statement;
     _options = options;
 }
 public TypescriptVariableDeclarationStatement(
     IStatementFactory statementFactory,
     IExpressionFactory expressionFactory,
     CodeVariableDeclarationStatement statement,
     CodeGeneratorOptions options)
 {
     _statementFactory = statementFactory;
     _expressionFactory = expressionFactory;
     _statement = statement;
     _options = options;
     _typescriptTypeMapper = new TypescriptTypeMapper();
 }
 public TypescriptTryCatchFinallyStatement(
     IStatementFactory statementFactory,
     IExpressionFactory expressionFactory,
     CodeTryCatchFinallyStatement statement,
     CodeGeneratorOptions options)
 {
     _statementFactory = statementFactory;
     _expressionFactory = expressionFactory;
     _statement = statement;
     _options = options;
     _typescriptTypeMapper = new TypescriptTypeMapper();
 }
Пример #16
0
 public TypescriptTryCatchFinallyStatement(
     IStatementFactory statementFactory,
     IExpressionFactory expressionFactory,
     CodeTryCatchFinallyStatement statement,
     CodeGeneratorOptions options)
 {
     _statementFactory     = statementFactory;
     _expressionFactory    = expressionFactory;
     _statement            = statement;
     _options              = options;
     _typescriptTypeMapper = new TypescriptTypeMapper();
 }
Пример #17
0
 public TypescriptVariableDeclarationStatement(
     IStatementFactory statementFactory,
     IExpressionFactory expressionFactory,
     CodeVariableDeclarationStatement statement,
     CodeGeneratorOptions options)
 {
     _statementFactory     = statementFactory;
     _expressionFactory    = expressionFactory;
     _statement            = statement;
     _options              = options;
     _typescriptTypeMapper = new TypescriptTypeMapper();
 }
 public TypescriptMemberProperty(
     CodeMemberProperty member,
     IStatementFactory statementFactory,
     IExpressionFactory expressionFactory,
     ITypescriptTypeMapper typescriptTypeMapper,
     CodeGeneratorOptions options)
 {
     _member               = member;
     _statementFactory     = statementFactory;
     _expressionFactory    = expressionFactory;
     _typescriptTypeMapper = typescriptTypeMapper;
     _options              = options;
 }
 public TypescriptMemberProperty(
     CodeMemberProperty member,
     IStatementFactory statementFactory,
     IExpressionFactory expressionFactory,
     ITypescriptTypeMapper typescriptTypeMapper,
     CodeGeneratorOptions options)
 {
     _member = member;
     _statementFactory = statementFactory;
     _expressionFactory = expressionFactory;
     _typescriptTypeMapper = typescriptTypeMapper;
     _options = options;
 }
Пример #20
0
        public static string GetStatementsFromCollection(this CodeStatementCollection statementCollection, IStatementFactory statementFactory, CodeGeneratorOptions options)
        {
            if (statementCollection.Count <= 0)
                return string.Empty;

            return statementCollection
                .OfType<CodeStatement>()
                .Select(statement =>
                {
                    var statementLines = statementFactory.GetStatement(statement, options);
                    return statementLines.Expand();
                })
                .Aggregate((previous, current) => $"{previous}{Environment.NewLine}{current}");
        }
 public TypescriptMemberMethod(
     IExpressionFactory expressionFactory,
     IStatementFactory statementFactory,
     ITypescriptTypeMapper typescriptTypeMapper,
     ITypescriptTypeParameter typescriptTypeParameter,
     CodeMemberMethod member,
     CodeGeneratorOptions options)
 {
     _expressionFactory = expressionFactory;
     _statementFactory = statementFactory;
     _typescriptTypeMapper = typescriptTypeMapper;
     _typescriptTypeParameter = typescriptTypeParameter;
     _member = member;
     _options = options;
 }
 public TypescriptMemberMethod(
     IExpressionFactory expressionFactory,
     IStatementFactory statementFactory,
     ITypescriptTypeMapper typescriptTypeMapper,
     ITypescriptTypeParameter typescriptTypeParameter,
     CodeMemberMethod member,
     CodeGeneratorOptions options)
 {
     _expressionFactory       = expressionFactory;
     _statementFactory        = statementFactory;
     _typescriptTypeMapper    = typescriptTypeMapper;
     _typescriptTypeParameter = typescriptTypeParameter;
     _member  = member;
     _options = options;
 }
Пример #23
0
        public IStatementStatus ChangeStatus(
            IStatementFactory statementFactory,
            StatusCode statusCode,
            StatusComment statusComment)
        {
            var statementStatus = statementFactory.NewStatus(
                this,
                statusCode,
                statusComment);

            this.CurrentStatus = statementStatus;
            this.StatusHistory.Add(statementStatus);

            return(statementStatus);
        }
Пример #24
0
        public MemberFactory(
            IExpressionFactory expressionFactory,
            IStatementFactory statementFactory,
            ITypescriptTypeMapper typescriptTypeMapper,
            ITypescriptTypeParameter typescriptTypeParameter)
        {
            _expressionFactory       = expressionFactory;
            _statementFactory        = statementFactory;
            _typescriptTypeMapper    = typescriptTypeMapper;
            _typescriptTypeParameter = typescriptTypeParameter;
            _memberMap = new Dictionary <Type, Func <CodeTypeMember, CodeGeneratorOptions, IMember> >();

            ConstructMembers();
            System.Diagnostics.Debug.WriteLine("MemberFactory Created");
        }
Пример #25
0
 public TypescriptCodeGenerator(
     IMemberFactory memberFactory,
     IStatementFactory statementFactory,
     IExpressionFactory expressionFactory,
     ITypescriptNamespace typescriptNamespace,
     ITypescriptTypeMapper typescriptTypeMapper,
     ITypescriptKeywordsHandler typescriptKeywordsHandler)
 {
     _memberFactory             = memberFactory;
     _typescriptKeywordsHandler = typescriptKeywordsHandler;
     _typescriptTypeMapper      = typescriptTypeMapper;
     _expressionFactory         = expressionFactory;
     _typescriptNamespace       = typescriptNamespace;
     _statementFactory          = statementFactory;
     System.Diagnostics.Debug.WriteLine("TypescriptCodeGenerator Created");
 }
 public TypescriptCodeGenerator(
     IMemberFactory memberFactory,
     IStatementFactory statementFactory, 
     IExpressionFactory expressionFactory,
     ITypescriptNamespace typescriptNamespace,
     ITypescriptTypeMapper typescriptTypeMapper,
     ITypescriptKeywordsHandler typescriptKeywordsHandler)
 {
     _memberFactory = memberFactory;
     _typescriptKeywordsHandler = typescriptKeywordsHandler;
     _typescriptTypeMapper = typescriptTypeMapper;
     _expressionFactory = expressionFactory;
     _typescriptNamespace = typescriptNamespace;
     _statementFactory = statementFactory;
     System.Diagnostics.Debug.WriteLine("TypescriptCodeGenerator Created");
 }
    public TransactionEtl(
        ILogger <TransactionEtl> logger,
        IBankStatementWebScraper bankStatementWebScraper,
        IStatementFactory statementFactory,
        ITransactionImportJobRepository transactionImportJobs,
        IAccountsRepository accounts,
        ITransactionsRepository transactions,
        IUnitOfWork unitOfWork,
        IOptions <TransactionEtlOptions> options)
    {
        _logger = logger;
        _bankStatementWebScraper = bankStatementWebScraper;
        _statementFactory        = statementFactory;
        _transactionImportJobs   = transactionImportJobs;
        _accounts     = accounts;
        _transactions = transactions;
        _unitOfWork   = unitOfWork;
        _options      = options.Value;

        _unprocessedPath = options.Value.UnprocessedStatementDirectory
                           ?? throw new ArgumentNullException(
                                     nameof(options.Value.UnprocessedStatementDirectory),
                                     "Unprocessed statement directory is required");

        if (!Directory.Exists(_unprocessedPath))
        {
            Directory.CreateDirectory(_unprocessedPath);
        }

        _processedPath = options.Value.ProcessedStatementDirectory
                         ?? throw new ArgumentNullException(
                                   nameof(options.Value.ProcessedStatementDirectory),
                                   "Processed statement directory is required");

        if (!Directory.Exists(_processedPath))
        {
            Directory.CreateDirectory(_processedPath);
        }

        _moveProcessedStatements = options.Value.MoveProcessedStatements;
    }
Пример #28
0
        public static string GetStatementsFromCollection(this CodeStatementCollection statementCollection, IStatementFactory statementFactory, CodeGeneratorOptions options)
        {
            if (statementCollection.Count <= 0)
            {
                return(string.Empty);
            }

            return(statementCollection
                   .OfType <CodeStatement>()
                   .Select(statement =>
            {
                var statementLines = statementFactory.GetStatement(statement, options);
                return statementLines.Expand();
            })
                   .Aggregate((previous, current) => $"{previous}{Environment.NewLine}{current}"));
        }
Пример #29
0
 public Repository(IStatementFactory statementFactory)
     : base(statementFactory)
 {
 }
Пример #30
0
 public StubStatementFactoryProvider()
 {
     _factory = null;
 }
Пример #31
0
 public Repository(IStatementFactory statementFactory)
 {
     this.statementFactory = statementFactory;
 }
Пример #32
0
 public StubStatementFactoryProvider(IStatementFactory factory)
 {
     _factory = factory;
 }