コード例 #1
0
        public void TestUpdate_NoLicenseInstalled()
        {
            //setup
            var goodLicense = TestLicense.Load("LicenseGood.xml");
            _mockStore.Setup(s => s.Read()).Returns(null as IXPathNavigable);

            //act
            var request = new UpdateLicenseRequest();
            HandleRequest<UpdateLicenseResponse>(_handler, request);
        }
コード例 #2
0
        public void TestUpdate_HappyPath()
        {
            //setup
            var goodLicense = TestLicense.Load("LicenseGood.xml");
            _mockServer.Setup(s => s.GetLicense(_licenseKey))
                .Returns(goodLicense);
            _mockVerifier.Setup(v => v.HasValidSignature(goodLicense))
                .Returns(true);
            _mockClock.Setup(c => c.Now)
                .Returns(new DateTime(2011, 9, 13));
            _mockStore.Setup(s => s.Read()).Returns(goodLicense);

            //act
            var request = new UpdateLicenseRequest();
            HandleRequest<UpdateLicenseResponse>(_handler, request);

            //assert
            _mockServer.Verify(s => s.GetLicense(_licenseKey), Times.Once());
            _mockVerifier.Verify(v => v.HasValidSignature(goodLicense), Times.Once());
            _mockStore.Verify(s => s.Save(goodLicense), Times.Once());
            _mockNotifier.Verify(n => n.SendBatch(It.IsAny<IEnumerable<MailMessage>>()), Times.Never());
        }
コード例 #3
0
 /// <summary>
 /// Occurs after the ServiceHost has started.
 /// </summary>
 public override void ServiceHostStarted()
 {
     var request = new UpdateLicenseRequest();
     _requestProcessor.Process(request);
 }