public Initialise ( DictionaryParameters parameters, IAppclusivePluginLogger logger, bool activate ) : bool | ||
parameters | DictionaryParameters | |
logger | IAppclusivePluginLogger | |
activate | bool | |
Résultat | bool |
public void LogSucceeds() { // Arrange var message = "arbitrary-message"; var logger = new Logger(); var sut = new DefaultPlugin(); sut.Initialise(new DictionaryParameters(), logger, true); // Act sut.Logger.WriteLine(message); // Assert // N/A }
public void InvokeConfigurationSucceeds() { // Arrange var parameters = new DictionaryParameters(); var key1 = "arbitrary-key1"; var value1 = "arbitrary-value"; parameters.Add(key1, value1); var key2 = "arbitrary-key2"; var value2 = 42; parameters.Add(key2, value2); var key3 = "arbitrary-key3"; var value3 = new object(); parameters.Add(key3, value3); var jobResult = new JobResult(); var schedulerPluginBase = Mock.Create<SchedulerPluginBase>(); Mock.Arrange(() => schedulerPluginBase.Invoke(Arg.IsAny<DictionaryParameters>(), Arg.IsAny<IInvocationResult>())) .IgnoreInstance() .CallOriginal() .MustBeCalled(); // Act var sut = new DefaultPlugin(); sut.Initialise(new DictionaryParameters(), new Logger(), true); var result = sut.Invoke(parameters, jobResult); // Assert Assert.IsTrue(result); Assert.IsNotNull(jobResult); Assert.IsTrue(jobResult.Description.Contains(key1)); Assert.IsTrue(jobResult.Description.Contains(value1.ToString())); Assert.IsTrue(jobResult.Description.Contains(key2)); Assert.IsTrue(jobResult.Description.Contains(value2.ToString())); Assert.IsTrue(jobResult.Description.Contains(key3)); Assert.IsTrue(jobResult.Description.Contains(value3.ToString())); Mock.Assert(schedulerPluginBase); }