public void TestMessageLogged() {
            PotatoController instance = new PotatoController();

            instance.Tunnel(CommandBuilder.PotatoServiceRestart().SetOrigin(CommandOrigin.Local));

            Assert.IsNotNull(instance.ServiceMessage);
            Assert.AreEqual("restart", instance.ServiceMessage.Name);

            instance.Dispose();
        }
        public void TestResultSuccess() {
            PotatoController instance = new PotatoController();

            ICommandResult result = instance.Tunnel(CommandBuilder.PotatoServiceRestart().SetOrigin(CommandOrigin.Local));

            Assert.IsTrue(result.Success);
            Assert.AreEqual(CommandResultType.Success, result.CommandResultType);

            instance.Dispose();
        }
        public void TestResultInvalidParameterPackageId() {
            PotatoController instance = new PotatoController();

            ICommandResult result = instance.Tunnel(CommandBuilder.PotatoServiceUninstallPackage("").SetOrigin(CommandOrigin.Local));

            Assert.IsFalse(result.Success);
            Assert.AreEqual(CommandResultType.InvalidParameter, result.CommandResultType);

            instance.Dispose();
        }
        public void TestMessageLogged() {
            PotatoController instance = new PotatoController();

            instance.Tunnel(CommandBuilder.PotatoServiceUninstallPackage("id").SetOrigin(CommandOrigin.Local));

            Assert.IsNotNull(instance.ServiceMessage);
            Assert.AreEqual("uninstall", instance.ServiceMessage.Name);
            Assert.AreEqual("id", instance.ServiceMessage.Arguments["packageid"]);

            instance.Dispose();
        }
Example #5
0
        public void TestResultSuccessUptimeReturned() {
            PotatoController instance = new PotatoController() {
                InstantiatedStamp = DateTime.Now.AddSeconds(-5)
            };

            ICommandResult result = instance.Tunnel(CommandBuilder.PotatoPing().SetOrigin(CommandOrigin.Local));

            Assert.GreaterOrEqual(int.Parse(result.Now.Content.First()), 5000);

            instance.Dispose();
        }
        public void TestResultInsufficientPermissions() {
            PotatoController instance = new PotatoController();

            ICommandResult result = instance.Tunnel(CommandBuilder.PotatoServiceRestart().SetOrigin(CommandOrigin.Remote).SetAuthentication(new CommandAuthenticationModel() {
                Username = "******"
            }));

            Assert.IsFalse(result.Success);
            Assert.AreEqual(CommandResultType.InsufficientPermissions, result.CommandResultType);

            instance.Dispose();
        }
        public void TestEventLogged() {
            EventsController events = new EventsController();
            PotatoController instance = new PotatoController {
                Shared = {
                    Events = events
                }
            };

            instance.Tunnel(CommandBuilder.PotatoServiceRestart().SetOrigin(CommandOrigin.Local));

            Assert.IsNotEmpty(events.LoggedEvents);
            Assert.AreEqual("PotatoServiceRestarting", events.LoggedEvents.First().Name);

            instance.Dispose();
        }