Kill() public method

public Kill ( ) : void
return void
示例#1
0
文件: AllTests.cs 项目: Ktibr/Mice
        public void ExperementalTest()
        {
            Person p = new Person();
            p.Kill();
            var isAlive = p.IsAlive;
            p.PersonPrototype.set_Name = delegate(Person self, string name)
                                {
                                    Assert.That(self, Is.SameAs(p));
                                    Assert.That(name, Is.EqualTo("ABC"));
                                    self.xName = name;
                                };
            p.Name = "ABC";
            Assert.That(p.Name, Is.EqualTo("ABC"));

            Soldier s = new Soldier();
            s.Rank = Rank.Captain;
            Assert.That(s.Rank, Is.EqualTo(Rank.Captain));
            Soldier.StaticPrototype.get_Rank = self => Rank.Lieutenant;
            Assert.That(s.Rank, Is.EqualTo(Rank.Lieutenant));

            Assert.That(Person.IsThereTrueLove, Is.EqualTo(false));
            Person.StaticPrototype.get_IsThereTrueLove = () => true;
            Assert.That(Person.IsThereTrueLove, Is.EqualTo(true));
        }
示例#2
0
        public void RealImplementationCallTest()
        {
            Person p = new Person();
            p.PersonPrototype.Kill = delegate { };
            p.Kill();

            Assert.That(p.IsAlive, Is.EqualTo(true));

            p.xKill();
            Assert.That(p.IsAlive, Is.EqualTo(false));
        }