コード例 #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);
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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);
        }
コード例 #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);
        }
コード例 #5
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);
        }
コード例 #6
0
        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");
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        public void Initialize()
        {
            var configuration = MockBuilder.BuildConfiguration();

            _logger = new Logger(configuration.Logging, configuration.AppName);
        }
コード例 #9
0
        private ISession GetSession()
        {
            var configuration = MockBuilder.BuildConfiguration();

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