コード例 #1
0
ファイル: AboutMethods.cs プロジェクト: ancasimon/Koans
        public void SubvertPrivateMethods()
        {
            InnerSecret secret             = new InnerSecret();
            string      superSecretMessage = secret.GetType()
                                             .GetMethod("SooperSeekrit", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
                                             .Invoke(secret, null) as string;

            Assert.Equal("No one will find me!", superSecretMessage);      //ANCA: Need some help figuring out the narrative of this code block!
        }
コード例 #2
0
        public void SubvertPrivateMethods()
        {
            InnerSecret secret             = new InnerSecret();
            string      superSecretMessage = secret.GetType()
                                             .GetMethod("SooperSeekrit", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
                                             .Invoke(secret, null) as string;

            Assert.Equal("No one will find me!", superSecretMessage);
        }
コード例 #3
0
        public void AboutMethodsSubvertPrivateMethods()
        {
            InnerSecret secret             = new InnerSecret();
            string      superSecretMessage = secret.GetType()
                                             .GetMethod("SooperSeekrit", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
                                             .Invoke(secret, null) as string;

            Assert.AreEqual(FILL_ME_IN, superSecretMessage);
        }