Exemple #1
0
        public void TestHashIds()
        {
            var configuration = MockBuilder.BuildConfiguration();
            var hashId        = new HashKeys(configuration.EncryptionSalt);
            var encrypted     = hashId.Encrypt(12345);
            var decrypt       = hashId.Decrypt(encrypted);

            Assert.AreEqual(decrypt, 12345);
        }
        private void ExecuteQuery(string query)
        {
            var configuration = MockBuilder.BuildConfiguration();
            var connection    = new NpgsqlConnection(configuration.SqlStore.ConnectionString);

            connection.Open();
            var command = new NpgsqlCommand(query, connection);

            command.ExecuteScalar();
            connection.Close();
        }
        private Raven.Client.Documents.DocumentStore GetSession(out IDocumentSession documentSession)
        {
            var documentStore = new Raven.Client.Documents.DocumentStore {
                Urls = new [] { MockBuilder.BuildConfiguration().DocumentStore.Url }
            };

            documentStore.Initialize();
            CreateDatabaseIfNotExists(documentStore, "Users");
            documentSession = documentStore.OpenSession("Users");
            return(documentStore);
        }
Exemple #4
0
        public void TestGenerateKey()
        {
            var configuration = MockBuilder.BuildConfiguration();
            var store         = new Raven.Client.Documents.DocumentStore {
                Urls = new[] { configuration.DocumentStore.Url }
            };

            store.Initialize();
            var documentStore = new DocumentStore(new DocumentSessionFactory(store, new NullLogger(), false), store);
            var generateKey   = new GenerateKey(documentStore);

            Assert.IsTrue(generateKey.GetNextNumericalKey("Tests") != 0);
        }
        public void TestSendEmailTask()
        {
            var containerBuilder = new AutofacContainerBuilder();
            var bootstrapper     = new ProviderBootstrapper(containerBuilder, MockBuilder.BuildConfiguration());
            var methodResult     = bootstrapper.Load(new MockHosting());

            var container = containerBuilder.Build();

            bootstrapper.InitializeFramework(container);
            var sendEmailTask = container.Resolve <SendEmailTask>();
            var result        = sendEmailTask.Execute().Result;

            Assert.AreEqual(result.MethodResultState, MethodResultStates.Successful);
        }
        public DocumentStoreTests()
        {
            var configuration = MockBuilder.BuildConfiguration();

            var documentSessionFactory = new DocumentSessionFactory(new Raven.Client.Documents.DocumentStore
            {
                Urls = new[] { configuration.DocumentStore.Url }
            },
                                                                    new NullLogger(),
                                                                    false);

            _documentStore = new DocumentStore(documentSessionFactory, new Raven.Client.Documents.DocumentStore());
            _documentStore.SetSession("Tests");
        }
        public void InitializeCompletely()
        {
            var containerBuilder = new AutofacContainerBuilder();
            var bootstrapper     = new ProviderBootstrapper(containerBuilder, MockBuilder.BuildConfiguration());
            var methodResult     = bootstrapper.Load(new MockHosting());

            var container = containerBuilder.Build();

            bootstrapper.InitializeFramework(container);

            Assert.AreEqual(methodResult.MethodResultState, MethodResultStates.Successful);
            Assert.AreNotEqual(container.Resolve <ILogger>(), null);
            Assert.AreNotEqual(container.Resolve <IDocumentStore>(), null);
            Assert.AreNotEqual(container.Resolve <IGraphStore>(), null);
            Assert.AreNotEqual(container.Resolve <ISqlStore>(), null);
            Assert.AreNotEqual(container.Resolve <IGenerateKey>(), null);
            Assert.AreNotEqual(container.Resolve <IHashKeys>(), null);
            Assert.AreNotEqual(container.Resolve <IEmailProvider>(), null);
            Assert.AreNotEqual(container.Resolve <ITemplateBuilder>(), null);
            Assert.AreNotEqual(container.Resolve <IBus>(), null);
            Assert.AreNotEqual(container.Resolve <ICommandService>(), null);
            Assert.AreNotEqual(container.Resolve <IEventBus>(), null);
            Assert.AreNotEqual(container.Resolve <IQueryService>(), null);
        }
Exemple #8
0
        public void Initialize()
        {
            var configuration = MockBuilder.BuildConfiguration();

            _logger = new Logger(configuration.Logging, configuration.AppName);
        }
        private ISession GetSession()
        {
            var configuration = MockBuilder.BuildConfiguration();

            return(GraphDatabase.Driver("bolt://localhost:7687", AuthTokens.Basic(configuration.GraphStore.Username, configuration.GraphStore.Password)).Session());
        }