示例#1
0
        public void TestSetup()
        {
            var state = new StateDescription(
                WuDataContract.Enums.WuStateId.Ready,
                "mock", "mock", WuDataContract.Enums.InstallerStatus.Ready,
                new WuEnviroment("mock", "mock", "mock", "mock", TimeSpan.MinValue, 1));
            var settings = new WuSettings(1, 1, 1, true, true);

            Castle.DynamicProxy.Generators.AttributesToAvoidReplicating.Add <ServiceContractAttribute>();
            _service = MoqFactory.Create <IWuRemoteService>(MockBehavior.Loose);

            _service.Setup(s => s.GetFQDN()).Returns("mock");
            _service.Setup(s => s.GetWuStatus()).Returns(state);
            _service.Setup(s => s.GetSettings()).Returns(settings);

            _service.As <IChannel>();

            var serviceFactory = MoqFactory.Create <WuRemoteServiceFactory>(MockBehavior.Loose);

            serviceFactory.Setup(f => f.GetInstance(
                                     It.IsAny <Binding>(),
                                     It.IsAny <EndpointAddress>(),
                                     It.IsAny <WuEndpoint.CallbackReceiver>())).Returns(_service.Object);
            _serviceFactory = serviceFactory.Object;
        }
示例#2
0
        public void Should_ContainSpecifiedValues_When_CreateWuSettings()
        {
            int timeout1 = 1, timeout2 = 2, timeout3 = 3;

            var set = new WuSettings(timeout1, timeout2, timeout3, true, false);

            Assert.AreEqual(set.SearchTimeoutSec, timeout1);
            Assert.AreEqual(set.DownloadTimeoutSec, timeout2);
            Assert.AreEqual(set.InstallTimeoutSec, timeout3);
            Assert.AreEqual(set.AutoAcceptEulas, true);
            Assert.AreEqual(set.AutoSelectUpdates, false);

            var set2 = new WuSettings(timeout1, timeout2, timeout3, false, true);

            Assert.AreEqual(set2.AutoAcceptEulas, false);
            Assert.AreEqual(set2.AutoSelectUpdates, true);
        }