示例#1
0
        public void UpdateFromExistingUpdatesExistingStatus(PackageState previousState, AccessCondition accessCondition, PackageState newState)
        {
            // Arrange
            var feedPackageIdentity = new FeedPackageIdentity("howdy", "3.4.6");

            var existingStatus = PackageMonitoringStatusTestUtility.CreateStatusWithPackageValidationResult(
                feedPackageIdentity.Id,
                feedPackageIdentity.Version,
                PackageMonitoringStatusTestUtility.GetTestResultFromPackageState(previousState));

            existingStatus.AccessCondition = accessCondition;

            var newStatus = PackageMonitoringStatusTestUtility.CreateStatusWithPackageValidationResult(
                feedPackageIdentity.Id,
                feedPackageIdentity.Version,
                PackageMonitoringStatusTestUtility.GetTestResultFromPackageState(newState));

            // Act
            PackageMonitoringStatusAccessConditionHelper.UpdateFromExisting(newStatus, existingStatus);

            // Assert
            foreach (var state in Enum.GetValues(typeof(PackageState)).Cast <PackageState>())
            {
                PackageMonitoringStatusTestUtility.AssertAccessCondition(
                    state == previousState ? accessCondition : AccessCondition.GenerateIfNotExistsCondition(),
                    newStatus.ExistingState[state]);
            }
        }
示例#2
0
        public void FromContentReturnsEmptyIfNullETag()
        {
            var content = new StringStorageContentWithETag("content", null);

            PackageMonitoringStatusTestUtility.AssertAccessCondition(
                AccessCondition.GenerateEmptyCondition(),
                PackageMonitoringStatusAccessConditionHelper.FromContent(content));
        }
示例#3
0
        public void FromContentReturnsMatchIfETag()
        {
            var eTag    = "etag";
            var content = new StringStorageContentWithETag("content", eTag);

            PackageMonitoringStatusTestUtility.AssertAccessCondition(
                AccessCondition.GenerateIfMatchCondition(eTag),
                PackageMonitoringStatusAccessConditionHelper.FromContent(content));
        }
示例#4
0
 public void FromUnknownReturnsEmptyCondition()
 {
     PackageMonitoringStatusTestUtility.AssertAccessCondition(
         AccessCondition.GenerateEmptyCondition(),
         PackageMonitoringStatusAccessConditionHelper.FromUnknown());
 }