Exemplo n.º 1
0
        public void TestDllLoad()
        {
            // by default DLLPath is 'h2napi.dll' i.e. current directory
            Assert.AreEqual("h2napi.dll", Hand2Note.DLLPath);

            // Hand2Note.Api.dll using lazy init strategy for loading h2napi.dll
            // call some method to force loadlibrary, we expect exception to be thrown, if no h2napi.dll in current path
            Assert.ThrowsException <InvalidOperationException> (() => ActivityMonitor.IsHand2NoteRunning);

            // set good path
            Hand2Note.DLLPath = FileSysHelpers.Hand2NoteApiDLLPath;

            // call method again, after that, dll should be loaded
            Assert.AreEqual(true, ActivityMonitor.IsHand2NoteRunning || true);

            // free dll, returns true if dll was successfully closed, we expect true, dll has been loaded after ActivityMonitor.IsHand2NoteRunning{get;}
            Assert.IsTrue(Hand2Note.FreeLibrary());

            // expect false if we try to free library again
            Assert.IsFalse(Hand2Note.FreeLibrary());
        }
Exemplo n.º 2
0
 public H2NActivityMonitorTest()
 {
     Hand2Note.DLLPath = FileSysHelpers.Hand2NoteApiDLLPath;
     // free dll before test cases
     Hand2Note.FreeLibrary();
 }
Exemplo n.º 3
0
 public H2NApiSendCommand()
 {
     Hand2Note.DLLPath = FileSysHelpers.Hand2NoteApiDLLPath;
     // free dll before test cases
     Hand2Note.FreeLibrary();
 }
Exemplo n.º 4
0
 public H2NApiDLLTest()
 {
     // free dll before test cases
     Hand2Note.FreeLibrary();
     Hand2Note.DLLPath = "h2napi.dll";
 }