Ejemplo n.º 1
0
        public void it_should_raise_OnEvent_for_kernel_trace()
        {
            var called = false;

            var trace = new KernelTrace();
            var proxy = new Proxy(trace);

            var provider = new ImageLoadProvider();

            provider.OnEvent += e => { called = true; };

            trace.Enable(provider);
            proxy.PushEvent(ImageLoadEvent.CreateRecord(123, "file.exe"));

            Assert.IsTrue(called, "proxy call raised on event");
        }
Ejemplo n.º 2
0
            public void it_should_parse_unicode_strings()
            {
                var data = "file.exe";
                var prop = ImageLoadEvent.FileName;

                var provider = new ImageLoadProvider();

                provider.OnEvent += e =>
                {
                    Assert.AreEqual(data, e.GetUnicodeString(prop));
                    Assert.AreEqual(data, e.GetUnicodeString(prop, String.Empty));

                    string result;
                    Assert.IsTrue(e.TryGetUnicodeString(prop, out result));
                    Assert.AreEqual(data, result);
                };

                trace.Enable(provider);
                proxy.PushEvent(PowerShellEvent.CreateRecord(
                                    data, String.Empty, String.Empty));
            }