NitroDebugger/NitroDebugger.UnitTests/PluginTests.cs
2015-03-15 11:06:44 +01:00

64 lines
1.5 KiB
C#

//
// PluginTests.cs
//
// Author:
// Benito Palacios Sánchez <benito356@gmail.com>
//
// 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 <http://www.gnu.org/licenses/>.
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<InvalidOperationException>(() => Plugin.Instances.First());
}
}
class TestPlugin : Plugin
{
}
}