// // PluginTests.cs // // Author: // Benito Palacios Sánchez // // Copyright (c) 2015 Benito Palacios Sánchez // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . using System; using System.Linq; using Moq; using NitroDebugger; using NUnit.Framework; namespace UnitTests { [TestFixture] public class PluginTests { [Test] public void GetInstance() { TestPlugin plugin = new TestPlugin(); Assert.AreSame(Plugin.Instances[0], plugin); plugin.Dispose(); } [Test] public void GetFirstInstance() { TestPlugin plugin1 = new TestPlugin(); TestPlugin plugin2 = new TestPlugin(); Assert.AreSame(Plugin.Instances.First(), plugin1); plugin1.Dispose(); plugin2.Dispose(); } [Test] public void RemoveAfterDispose() { TestPlugin plugin = new TestPlugin(); plugin.Dispose(); Assert.Throws(() => Plugin.Instances.First()); } } class TestPlugin : Plugin { } }