Beispiel #1
0
 public ProcessDefinitionStoreTests()
 {
     store = new ProcessDefinitionStoreD();
     pd    = new ProcessDefinition();
     pd.ProcessDefinitionId = Guid.NewGuid().ToString();
     store.Create(pd);
 }
Beispiel #2
0
        public void DisposeTest()
        {
            ProcessDefinitionStoreD actual = new ProcessDefinitionStoreD();

            actual.Dispose();
            Assert.IsNotNull(actual);
        }
Beispiel #3
0
        public void CacheCreate1000000Test()
        {
            Stopwatch w = new Stopwatch();

            w.Start();
            var store = new ProcessDefinitionStoreD();

            w.Stop();
            Debug.WriteLine("Initialize instance : " + w.ElapsedMilliseconds + "ms");
            w.Restart();
            for (int i = 0; i < 1000000; i++)
            {
                var t = new ProcessDefinition();
                t.ProcessDefinitionId = Guid.NewGuid().ToString();
                store.Create(t);
            }
            w.Stop();
            Debug.WriteLine("Add1000000Test : " + w.ElapsedMilliseconds + "ms");
            w.Restart();
            for (int i = 0; i < 1000000; i++)
            {
                var t = new ProcessDefinition();
                t.ProcessDefinitionId = Guid.NewGuid().ToString();
                store.Create(t);
            }
            w.Stop();
            Debug.WriteLine("Add1000000Test : " + w.ElapsedMilliseconds + "ms");
            store.Dispose();
        }
Beispiel #4
0
        public void CacheCreate100000TestAsync()
        {
            Stopwatch w = new Stopwatch();

            w.Start();
            var store = new ProcessDefinitionStoreD();

            Task[] task = new Task[100000];
            for (int i = 0; i < 100000; i++)
            {
                task[i] = Task.Run(() => {
                    var t = new ProcessDefinition();
                    t.ProcessDefinitionId = Guid.NewGuid().ToString();
                    store.Create(t);
                });
            }
            Task.WaitAll(task);
            w.Stop();
            Debug.WriteLine("CacheCreate100000TestAsync : " + w.ElapsedMilliseconds + "ms");
            store.Dispose();
        }