示例#1
0
 public override void SetupTest()
 {
     base.SetupTest();
     websiteChannelMock = new Mock <IWebsitesServiceManagement>();
     websitesClientMock = new Mock <IWebsitesClient>();
     commandRuntimeMock = new Mock <ICommandRuntime>();
     stopCondition      = (string line) => line != null;
     websitesClientMock.Setup(f => f.StartLogStreaming(
                                  websiteName,
                                  string.Empty,
                                  string.Empty,
                                  stopCondition,
                                  It.IsAny <int>()))
     .Returns(logs);
     logs = new List <string>()
     {
         "Log1", "Error: Log2", "Log3", "Error: Log4", null
     };
     getAzureWebsiteLogCmdlet = new GetAzureWebsiteLogCommand(websiteChannelMock.Object, null)
     {
         CommandRuntime = commandRuntimeMock.Object,
         WebsiteClient  = websitesClientMock.Object,
         StopCondition  = stopCondition,
         Name           = websiteName,
         ShareChannel   = true
     };
     website = new Site()
     {
         Name           = websiteName,
         WebSpace       = "webspaceName",
         SiteProperties = new SiteProperties()
         {
             Properties = new List <NameValuePair>()
             {
                 new NameValuePair()
                 {
                     Name = UriElements.RepositoryUriProperty, Value = repoUrl
                 }
             }
         }
     };
     Cache.AddSite(getAzureWebsiteLogCmdlet.CurrentSubscription.SubscriptionId, website);
     websiteChannelMock.Setup(f => f.BeginGetSite(
                                  getAzureWebsiteLogCmdlet.CurrentSubscription.SubscriptionId,
                                  null,
                                  websiteName,
                                  "repositoryuri,publishingpassword,publishingusername",
                                  null,
                                  null))
     .Returns(It.IsAny <IAsyncResult>());
     websiteChannelMock.Setup(f => f.EndGetSite(It.IsAny <IAsyncResult>())).Returns(website);
 }
 public override void SetupTest()
 {
     base.SetupTest();
     websitesClientMock = new Mock <IWebsitesClient>();
     commandRuntimeMock = new Mock <ICommandRuntime>();
     stopCondition      = (string line) => line != null;
     websitesClientMock.Setup(f => f.StartLogStreaming(
                                  websiteName,
                                  slot,
                                  string.Empty,
                                  string.Empty,
                                  stopCondition,
                                  It.IsAny <int>()))
     .Returns(logs);
     logs = new List <string>()
     {
         "Log1", "Error: Log2", "Log3", "Error: Log4", null
     };
     getAzureWebsiteLogCmdlet = new GetAzureWebsiteLogCommand(null)
     {
         CommandRuntime = commandRuntimeMock.Object,
         WebsitesClient = websitesClientMock.Object,
         StopCondition  = stopCondition,
         Name           = websiteName,
         ShareChannel   = true,
         Slot           = slot
     };
     website = new Site()
     {
         Name           = websiteName,
         WebSpace       = "webspaceName",
         SiteProperties = new SiteProperties()
         {
             Properties = new List <NameValuePair>()
             {
                 new NameValuePair()
                 {
                     Name = UriElements.RepositoryUriProperty, Value = repoUrl
                 }
             }
         }
     };
     Cache.AddSite(getAzureWebsiteLogCmdlet.CurrentSubscription.SubscriptionId, website);
     websitesClientMock.Setup(c => c.GetWebsite(websiteName, slot))
     .Returns(website);
 }
 public override void SetupTest()
 {
     base.SetupTest();
     websitesClientMock = new Mock<IWebsitesClient>();
     commandRuntimeMock = new Mock<ICommandRuntime>();
     stopCondition = (string line) => line != null;
     websitesClientMock.Setup(f => f.StartLogStreaming(
         websiteName,
         slot,
         string.Empty,
         string.Empty,
         stopCondition,
         It.IsAny<int>()))
         .Returns(logs);
     logs = new List<string>() { "Log1", "Error: Log2", "Log3", "Error: Log4", null };
     getAzureWebsiteLogCmdlet = new GetAzureWebsiteLogCommand(null)
     {
         CommandRuntime = commandRuntimeMock.Object,
         WebsitesClient = websitesClientMock.Object,
         StopCondition = stopCondition,
         Name = websiteName,
         ShareChannel = true,
         Slot = slot
     };
     website = new Site()
     {
         Name = websiteName,
         WebSpace = "webspaceName",
         SiteProperties = new SiteProperties()
         {
             Properties = new List<NameValuePair>()
             {
                 new NameValuePair() { Name = UriElements.RepositoryUriProperty, Value = repoUrl }
             }
         }
     };
     Cache.AddSite(getAzureWebsiteLogCmdlet.CurrentSubscription.SubscriptionId, website);
     websitesClientMock.Setup(c => c.GetWebsite(websiteName, slot))
         .Returns(website);
 }