public override void ExecuteCmdlet() { DateTime today = DateTime.Now; if (String.IsNullOrWhiteSpace(UsageMonth)) { UsageMonth = today.Month.ToString(); } if (String.IsNullOrWhiteSpace(UsageYear)) { UsageYear = today.Year.ToString(); } CollectionUsageSummaryListResult usageSummary = CallClient(() => Client.Collections.GetUsageSummary(CollectionName, UsageYear, UsageMonth), Client.Collections); if (usageSummary != null) { if (usageSummary.UsageSummaryList.Count > 0) { WriteObject(usageSummary.UsageSummaryList, true); } else { WriteVerboseWithTimestamp(Commands_RemoteApp.UseageNotFound); } } }
public void CanGetCollectionUsageSummary() { using (var undoContext = UndoContext.Current) { undoContext.Start(); var client = GetRemoteAppManagementClient(); CollectionUsageSummaryListResult billingSummary = client.Collections.GetUsageSummary("simple", "2015", "2"); Assert.NotNull(billingSummary); Assert.Equal(HttpStatusCode.OK, billingSummary.StatusCode); Assert.NotNull(billingSummary.UsageSummaryList); Assert.NotEmpty(billingSummary.UsageSummaryList); Assert.False(String.IsNullOrWhiteSpace(billingSummary.UsageSummaryList[0].UserName), "The user name must not be empty."); } }