-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #51 Added test for config saving plugin enabled
- Loading branch information
Geoff Green
committed
Mar 7, 2014
1 parent
d535892
commit a026898
Showing
4 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
using Procon.Core.Connections; | ||
using Procon.Core.Connections.Plugins; | ||
using Procon.Core.Shared; | ||
using Procon.Core.Shared.Models; | ||
|
||
namespace Procon.Core.Test.Plugins { | ||
[TestFixture] | ||
public class TestPluginConfig { | ||
/// <summary> | ||
/// Tests that an enabled plugin will have the enabled command saved to the config | ||
/// </summary> | ||
[Test] | ||
public void TestEnabledPluginSavedToConfig() { | ||
Guid connectionGuid = Guid.NewGuid(); | ||
Guid onePluginGuid = Guid.NewGuid(); | ||
Guid twoPluginGuid = Guid.NewGuid(); | ||
|
||
ICorePluginController plugins = new CorePluginController() { | ||
Connection = new ConnectionController() { | ||
ConnectionModel = new ConnectionModel() { | ||
ConnectionGuid = connectionGuid | ||
} | ||
}, | ||
LoadedPlugins = new List<PluginModel>() { | ||
new PluginModel() { | ||
Name = "One", | ||
IsEnabled = false, | ||
PluginGuid = onePluginGuid | ||
}, | ||
new PluginModel() { | ||
Name = "Two", | ||
IsEnabled = true, | ||
PluginGuid = twoPluginGuid | ||
} | ||
} | ||
}; | ||
|
||
IConfig config = new Config().Create<CorePluginController>(); | ||
|
||
plugins.WriteConfig(config); | ||
|
||
Assert.AreEqual(config.Root.First.Value<String>("Name"), "PluginsEnable"); | ||
Assert.AreEqual(config.Root.First["ScopeModel"].Value<String>("ConnectionGuid"), connectionGuid.ToString()); | ||
Assert.AreEqual(config.Root.First["ScopeModel"].Value<String>("PluginGuid"), twoPluginGuid.ToString()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters