Exemplo n.º 1
0
        private static string Format(Bp b)
        {
            string s = "[" + b.GetType().Name + "]";

            s += " " + b.a;
            if (b.b == null)
            {
                return(s + " null");
            }
            s += " " + b.b.Count;
            foreach (var i in b.b)
            {
                s += ": " + i;
            }
            return(s);
        }
Exemplo n.º 2
0
        } // end constructor

        // N.B. Assumes we are on the dbgeng thread.
        internal void Refresh()
        {
            uint id;

            CheckHr(Bp.GetId(out id));
            DEBUG_BREAKPOINT_PARAMETERS[] bpParams;
            uint[] ids = new uint[] { id };
            int    hr  = m_debugControl.GetBreakpointParameters(ids, out bpParams);

            if (S_FALSE == hr)
            {
                // Uh-oh... breakpoint isn't valid anymore.
                MarkInvalid();
            }
            else
            {
                CheckHr(hr);
                m_nativeParams = bpParams[0];
            }
        } // end Refresh()
Exemplo n.º 3
0
        public void Execute()
        {
            //Test Data
            App app = new App();
            Apf apf = new Apf();
            Afp afp = new Afp();
            Aff aff = new Aff();
            Bp  bp1 = new Bp()
            {
                a = "b1"
            };
            Bp bp2 = new Bp()
            {
                a = "b2"
            };
            Bf bf1 = new Bf()
            {
                a = "b1"
            };
            Bf bf2 = new Bf()
            {
                a = "b2"
            };

            bp1.b = new List <string>();
            bp2.b = new List <string>();
            bf1.b = new List <string>();
            bf2.b = new List <string>();
            bp1.b.Add("a");
            bp2.b.Add("b");
            bf1.b.Add("a");
            bf2.b.Add("b");
            app.list.Add(bp1);
            app.list.Add(bp2);
            apf.list.Add(bf1);
            apf.list.Add(bf2);
            afp.list.Add(bp1);
            afp.list.Add(bp2);
            aff.list.Add(bf1);
            aff.list.Add(bf2);

            using StringWriter before = new StringWriter();
            before.WriteLine(Format(app));
            before.WriteLine(Format(apf));
            before.WriteLine(Format(afp));
            before.WriteLine(Format(aff));

            //Serialize
            MemoryStream mspp = new MemoryStream();
            MemoryStream mspf = new MemoryStream();
            MemoryStream msfp = new MemoryStream();
            MemoryStream msff = new MemoryStream();

            Serializer.Serialize(mspp, app);
            Serializer.Serialize(mspf, apf);
            Serializer.Serialize(msfp, afp);
            Serializer.Serialize(msff, aff);

            //Compare binary data
            byte[] bpp = mspp.ToArray();
            byte[] bpf = mspf.ToArray();
            byte[] bfp = msfp.ToArray();
            byte[] bff = msff.ToArray();

            Assert.Equal(18, bpp.Length);

            if (bpp.Length != bpf.Length)
            {
                throw new InvalidDataException("Length does not match");
            }
            if (bpf.Length != bff.Length)
            {
                throw new InvalidDataException("Length does not match");
            }
            if (bff.Length != bfp.Length)
            {
                throw new InvalidDataException("Length does not match");
            }
            for (int n = 0; n < bpp.Length; n++)
            {
                if (bpp[n] != bpf[n] || bpf[n] != bff[n] || bff[n] != bfp[n])
                {
                    throw new InvalidDataException("Data does not match");
                }
            }

            //Deserialize
            StringWriter after = new StringWriter();

            Deserialize(bpp, after);

            Assert.Equal(before.ToString(), after.ToString());
        }
Exemplo n.º 4
0
        public void Execute()
        {
            //Test Data
            App app = new App();
            Apf apf = new Apf();
            Afp afp = new Afp();
            Aff aff = new Aff();
            Bp bp1 = new Bp() { a = "b1" };
            Bp bp2 = new Bp() { a = "b2" };
            Bf bf1 = new Bf() { a = "b1" };
            Bf bf2 = new Bf() { a = "b2" };
            bp1.b = new List<string>();
            bp2.b = new List<string>();
            bf1.b = new List<string>();
            bf2.b = new List<string>();
            bp1.b.Add("a");
            bp2.b.Add("b");
            bf1.b.Add("a");
            bf2.b.Add("b");
            app.list.Add(bp1);
            app.list.Add(bp2);
            apf.list.Add(bf1);
            apf.list.Add(bf2);
            afp.list.Add(bp1);
            afp.list.Add(bp2);
            aff.list.Add(bf1);
            aff.list.Add(bf2);

            StringWriter before = new StringWriter();
            before.WriteLine(Format(app));
            before.WriteLine(Format(apf));
            before.WriteLine(Format(afp));
            before.WriteLine(Format(aff));

            //Serialize
            MemoryStream mspp = new MemoryStream();
            MemoryStream mspf = new MemoryStream();
            MemoryStream msfp = new MemoryStream();
            MemoryStream msff = new MemoryStream();
            Serializer.Serialize(mspp, app);
            Serializer.Serialize(mspf, apf);
            Serializer.Serialize(msfp, afp);
            Serializer.Serialize(msff, aff);

            //Compare binary data
            byte[] bpp = mspp.ToArray();
            byte[] bpf = mspf.ToArray();
            byte[] bfp = msfp.ToArray();
            byte[] bff = msff.ToArray();

            Assert.AreEqual(18, bpp.Length);

            if (bpp.Length != bpf.Length)
                throw new InvalidDataException("Length does not match");
            if (bpf.Length != bff.Length)
                throw new InvalidDataException("Length does not match");
            if (bff.Length != bfp.Length)
                throw new InvalidDataException("Length does not match");
            for (int n = 0; n < bpp.Length; n++)
            {
                if (bpp[n] != bpf[n] || bpf[n] != bff[n] || bff[n] != bfp[n])
                    throw new InvalidDataException("Data does not match");
            }

            //Deserialize
            StringWriter after = new StringWriter();
            Deserialize(bpp, after);

            Assert.AreEqual(before.ToString(), after.ToString());

        }
Exemplo n.º 5
0
 private static string Format(Bp b)
 {
     string s = "[" + b.GetType().Name + "]";
     s += " " + b.a;
     if (b.b == null)
         return s + " null";
     s += " " + b.b.Count;
     foreach (var i in b.b)
         s += ": " + i;
     return s;
 }