Exemple #1
0
 public CspSubsctriptionAvailableLicenseNumberAlignmentResult(
     SubscriptionCspId subscriptionId,
     LicenseQuantity originalNumberOfAvailableLicenses,
     LicenseQuantity newNumberOfAvailableLicenses)
 {
     SubscriptionId = subscriptionId
                      ?? throw new ArgumentNullException(nameof(subscriptionId));
     this.originalNumberOfAvailableLicenses = originalNumberOfAvailableLicenses
                                              ?? throw new ArgumentNullException(nameof(originalNumberOfAvailableLicenses));
     NewNumberOfAvailableLicenses = newNumberOfAvailableLicenses
                                    ?? throw new ArgumentNullException(nameof(newNumberOfAvailableLicenses));
 }
Exemple #2
0
 public CspSubscription(
     SubscriptionCspId id,
     LicenseQuantity numberOfAvailableLicenses,
     LicenseQuantity numberOfAssignedLicenses,
     LicenseQuantity minAllowedNumberOfAvailableLicenses,
     LicenseQuantity maxAllowedNumberOfAvailableLicenses)
 {
     Id = id
          ?? throw new ArgumentNullException(nameof(id));
     NumberOfAvailableLicenses = numberOfAvailableLicenses
                                 ?? throw new ArgumentNullException(nameof(numberOfAvailableLicenses));
     this.numberOfAssignedLicenses = numberOfAssignedLicenses
                                     ?? throw new ArgumentNullException(nameof(numberOfAssignedLicenses));
     this.minAllowedNumberOfAvailableLicenses = minAllowedNumberOfAvailableLicenses
                                                ?? throw new ArgumentNullException(nameof(minAllowedNumberOfAvailableLicenses));
     this.maxAllowedNumberOfAvailableLicenses = maxAllowedNumberOfAvailableLicenses
                                                ?? throw new ArgumentNullException(nameof(maxAllowedNumberOfAvailableLicenses));
 }
Exemple #3
0
        public CspSubsctriptionAvailableLicenseNumberAlignmentResult AlignNumberOfAvailableAndAssignedLicenses()
        {
            LicenseQuantity newNumberOfAvailableLicenses;

            if (numberOfAssignedLicenses < minAllowedNumberOfAvailableLicenses)
            {
                newNumberOfAvailableLicenses = new LicenseQuantity(minAllowedNumberOfAvailableLicenses);
            }
            else if (numberOfAssignedLicenses > maxAllowedNumberOfAvailableLicenses)
            {
                newNumberOfAvailableLicenses = new LicenseQuantity(maxAllowedNumberOfAvailableLicenses);
            }
            else
            {
                newNumberOfAvailableLicenses = new LicenseQuantity(numberOfAssignedLicenses);
            }

            return(new CspSubsctriptionAvailableLicenseNumberAlignmentResult(
                       Id,
                       NumberOfAvailableLicenses,
                       newNumberOfAvailableLicenses));
        }
 public void BeEqualToAnotherLicenseQuantityWithTheSameValue(LicenseQuantity first, LicenseQuantity second)
 {
     first.Should().Be(second);
     first.GetHashCode().Should().Be(second.GetHashCode());
     (first == second).Should().BeTrue();
 }
Exemple #5
0
 public void ChangeSubscriptionQuantity(
     CustomerCspId customerId, SubscriptionCspId subscriptionId, LicenseQuantity newQuantity)
 {
     microsoftOffice365SubscriptionsOperationsMock.Object
     .ChangeSubscriptionQuantity(customerId, subscriptionId, newQuantity);
 }