public void ProcessEntityIncludeInExceptions() { bool ignoreStatus = false; string entityName = "myEntity"; List <string> exceptions = new List <string>() { "someentity1", entityName, "entity with tpyo inname" }; Entity entity = new Entity() { LogicalName = entityName }; entity.Attributes.Add(EntityStatusProcessor.StatusFields.ElementAt(0), new OptionSetValue(2)); entity.Attributes.Add(EntityStatusProcessor.StatusFields.ElementAt(1), new OptionSetValue(4)); EntityWrapper entityWrapper = new EntityWrapper(entity); EntityStatusProcessor processor = new EntityStatusProcessor(ignoreStatus, exceptions); processor.ProcessEntity(entityWrapper, (int)PassType.SetRecordStatus, (int)PassType.SetRecordStatus); Assert.AreEqual(OperationType.Ignore, entityWrapper.OperationType); }
public void ProcessEntityRemovedOnOtherPasses() { bool ignoreStatus = false; string entityName = "myEntity"; List <string> exceptions = new List <string>() { "someentity1", entityName, "entity with tpyo inname" }; Entity entity = new Entity() { LogicalName = entityName }; entity.Attributes.Add(EntityStatusProcessor.StatusFields.ElementAt(0), new OptionSetValue(2)); entity.Attributes.Add(EntityStatusProcessor.StatusFields.ElementAt(1), new OptionSetValue(4)); EntityWrapper entityWrapper = new EntityWrapper(entity); EntityStatusProcessor processor = new EntityStatusProcessor(ignoreStatus, exceptions); processor.ProcessEntity(entityWrapper, (int)PassType.SetRecordStatus + 1, (int)PassType.SetRecordStatus); Assert.IsFalse(entity.Contains(EntityStatusProcessor.StatusFields.ElementAt(0))); Assert.IsFalse(entity.Contains(EntityStatusProcessor.StatusFields.ElementAt(1))); }
public BaseFacts() { Package = new Package { PackageRegistration = new PackageRegistration(), PackageStatusKey = PackageStatus.Validating, }; ValidationSet = new PackageValidationSet { PackageValidations = new List <PackageValidation> { new PackageValidation { Type = "SomeValidator" }, } }; PackageServiceMock = new Mock <IEntityService <Package> >(); PackageFileServiceMock = new Mock <IValidationFileService>(); ValidatorProviderMock = new Mock <IValidatorProvider>(); TelemetryServiceMock = new Mock <ITelemetryService>(); LoggerMock = new Mock <ILogger <EntityStatusProcessor <Package> > >(); var streamMetadata = new PackageStreamMetadata() { Size = 1, Hash = "hash", HashAlgorithm = CoreConstants.Sha512HashAlgorithmId }; PackageFileServiceMock .Setup(x => x.UpdatePackageBlobMetadataAsync(It.IsAny <PackageValidationSet>())) .ReturnsAsync(streamMetadata); Target = new EntityStatusProcessor <Package>( PackageServiceMock.Object, PackageFileServiceMock.Object, ValidatorProviderMock.Object, TelemetryServiceMock.Object, LoggerMock.Object); PackageValidatingEntity = new PackageValidatingEntity(Package); }
public void Setup() { systemUnderTest = new EntityStatusProcessor(false, new List <string>()); }