Ejemplo n.º 1
0
        public void AddTileEntity_Succeeded_WasLogged(int x, int y)
        {
            var tileEntity   = Mock.Of <ITileEntity>(e => e.Position == new Vector(x, y));
            var extent       = Mock.Of <Extent>(e => e.AddTileEntity(tileEntity));
            var changeSet    = new ChangeSet();
            var loggedExtent = new LoggedExtent(extent, changeSet);

            Assert.That(loggedExtent.AddTileEntity(tileEntity));
            Assert.That(changeSet.Undo(extent), Is.EqualTo(1));
        }
Ejemplo n.º 2
0
        public void AddTileEntity_Failed_WasNotLogged(int x, int y)
        {
            var tileEntity   = Mock.Of <ITileEntity>(e => e.Position == new Vector(x, y));
            var extent       = Mock.Of <Extent>(e => !e.AddTileEntity(tileEntity));
            var changeSet    = new ChangeSet();
            var loggedExtent = new LoggedExtent(extent, changeSet);

            Assert.That(!loggedExtent.AddTileEntity(tileEntity));
            Assert.That(changeSet.Undo(extent), Is.Zero);
        }