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]); } }
public void FromContentReturnsEmptyIfNullETag() { var content = new StringStorageContentWithETag("content", null); PackageMonitoringStatusTestUtility.AssertAccessCondition( AccessCondition.GenerateEmptyCondition(), PackageMonitoringStatusAccessConditionHelper.FromContent(content)); }
public void FromContentReturnsMatchIfETag() { var eTag = "etag"; var content = new StringStorageContentWithETag("content", eTag); PackageMonitoringStatusTestUtility.AssertAccessCondition( AccessCondition.GenerateIfMatchCondition(eTag), PackageMonitoringStatusAccessConditionHelper.FromContent(content)); }
public void FromUnknownReturnsEmptyCondition() { PackageMonitoringStatusTestUtility.AssertAccessCondition( AccessCondition.GenerateEmptyCondition(), PackageMonitoringStatusAccessConditionHelper.FromUnknown()); }