public ActivityAdded(string text, DateTimeOffset time, ActivityId activityId, ICollection<ActivityReference> references) { Text = text; Time = time; ActivityId = activityId; References = references; }
public void ShouldCreateRecordingRole(ActivityId activity) { var recordingRoleInActivity = RoleInActivity.Recording(activity); recordingRoleInActivity.Activity.ShouldBe(activity); recordingRoleInActivity.Role.ShouldBe(DeviceRole.Recording); }
public void ShouldBeRecordingWhenUsedForAudioRecording( Microphone microphone, ActivityId audioRecording) { microphone.UseForAudioRecording(audioRecording); microphone.IsInRole(RoleInActivity.Recording(audioRecording)).ShouldBeTrue(); }
public void ShouldBeRecordingWhenUsedForVideoRecording( VideoCamera videoCamera, ActivityId videoRecording) { videoCamera.UseForVideoRecording(videoRecording); videoCamera.IsInRole(RoleInActivity.Recording(videoRecording)).ShouldBeTrue(); }
public void CannotUseForAudioRecordingWhenAlreadyRecording( Microphone microphone, ActivityId previousAudioRecording, ActivityId newAudioRecording) { microphone.UseForAudioRecording(previousAudioRecording); microphone.UseForAudioRecording(newAudioRecording).ShouldBeFalse(); }
public static AdvertisementCreationData Create(ActivityId activityId, DateTime timestamp, AdvertisementFlags flags) { return new AdvertisementCreationData() { ActivityId = activityId, Timestamp = timestamp, Flags = flags, }; }
/// <summary> /// Initializes a new instance of the <see cref="VideoRecording"/> class. /// </summary> /// <param name="activityId"> /// The unique <see cref="ActivityId"/> of this video recording activity. /// </param> public VideoRecording(ActivityId activityId) { if (activityId == null) { throw new ArgumentNullException(nameof(activityId)); } ActivityId = activityId; }
public void CannotUseForVideoRecordingWhenAlreadyRecording( VideoCamera videoCamera, ActivityId previousVideoRecording, ActivityId newVideoRecording) { videoCamera.UseForVideoRecording(previousVideoRecording); videoCamera.UseForVideoRecording(newVideoRecording).ShouldBeFalse(); }
public void ShouldBeAvailableWhenStoppingUseForAudioRecording( Microphone microphone, ActivityId audioRecording) { microphone.UseForAudioRecording(audioRecording); microphone.StopUsingForAudioRecording(audioRecording); microphone.IsAvailable().ShouldBe(true); }
public override int GetHashCode() { unchecked { var hashCode = AssigneeId.GetHashCode(); hashCode = (hashCode * 397) ^ ActivityId.GetHashCode(); hashCode = (hashCode * 397) ^ ProjectId.GetHashCode(); hashCode = (hashCode * 397) ^ LoggedTimeId.GetHashCode(); return(hashCode); } }
/// <summary> /// Increment the sequence number and generate the new ActviityId /// </summary> /// <returns>ActivityId</returns> internal static ActivityId Next() { if (tlsActivity == null) { tlsActivity = new ActivityId(); } tlsActivity.Increment(); return(new ActivityId(tlsActivity)); }
/// <summary> /// Increment the sequence number and generate the new ActviityId /// </summary> /// <returns>ActivityId</returns> internal static ActivityId Next() { if (t_tlsActivity == null) { t_tlsActivity = new ActivityId(); } t_tlsActivity.Increment(); return new ActivityId(t_tlsActivity); }
public CreateClientConnectedArguments( IMediatorServiceInternalUse medaitorService, IMediatorClient medaitorClient, ActivityId activityId, RequestRelatedType requestRelatedType ) { this.MedaitorService = medaitorService; this.MedaitorClient = medaitorClient; this.ActivityId = activityId; this.RequestRelatedType = requestRelatedType; }
public override int GetHashCode() { int hash = 1; if (ActivityId != 0) { hash ^= ActivityId.GetHashCode(); } hash ^= activityCapsuleItemPB_.GetHashCode(); hash ^= consumeItemsPB_.GetHashCode(); return(hash); }
public override async Task FollowUp() { await FillDropdowns(); if (!ActivityUI.BuildSolutionButton.Clicked) { return; } ActivityPayload.ChildrenActivities.Clear(); //We need to keep the versions we know how to work with. If later these child activities will be upgraded we probably won't be able to configure them properly var activityTemplates = await HubCommunicator.GetActivityTemplates(); var configureMonitorActivityTask = ConfigureMonitorActivity(activityTemplates); var configureSetDelayTask = ConfigureSetDelayActivity(activityTemplates); var configureQueryFr8Task = ConfigureQueryFr8Activity(activityTemplates); var configureTestDataTask = ConfigureFilterDataActivity(activityTemplates); await Task.WhenAll(configureMonitorActivityTask, configureSetDelayTask, configureQueryFr8Task, configureTestDataTask); //If solution was already built and we should replace notifier action var previousNotifierId = NotifierActivityId; var previousNotifierTemplateId = NotifierActivityTemplateId; var isInitialBuild = previousNotifierId == Guid.Empty; if (isInitialBuild) { await ConfigureBuildMessageActivity(activityTemplates); } var currentNotifierTemplateId = NotifierActivityTemplateId = Guid.Parse(ActivityUI.NotifierSelector.Value); if (isInitialBuild || currentNotifierTemplateId != previousNotifierTemplateId) { //If it is not initial build we should remove existing notifier from plan var previousNotifierOrdering = 3; if (!isInitialBuild) { var currentPlan = (await HubCommunicator.GetPlansByActivity(ActivityId.ToString())); var startingSubPlan = currentPlan.SubPlans.First(x => x.SubPlanId == currentPlan.StartingSubPlanId); var previousNotifier = startingSubPlan.Activities.FirstOrDefault(x => x.Id == previousNotifierId); if (previousNotifier != null) { previousNotifierOrdering = previousNotifier.Ordering; await HubCommunicator.DeleteActivity(previousNotifierId); } } //And we should add new notifier anyway NotifierActivityId = await ConfigureNotifierActivity(activityTemplates, previousNotifierOrdering); } ; ActivityPayload.ChildrenActivities.Sort((x, y) => x.Ordering.CompareTo(y.Ordering)); ActivityPayload.ChildrenActivities[0] = configureMonitorActivityTask.Result; ActivityPayload.ChildrenActivities[2] = configureQueryFr8Task.Result; }
public Task <string> GetCurrentActivityId() { string currentActivityId; if (!ActivityId.TryGetCurrentActivityId(out currentActivityId)) { throw new Exception("Current activity id not found!"); } ServiceEventSource.Current.Message("Invoked for activity id: {0}", currentActivityId); return(Task.FromResult(currentActivityId)); }
public Dictionary <string, string> ToQueryStringDictionary() { return(new Dictionary <string, string> { { "userId", UserId?.ToString("D") }, { "startDate", StartDate?.ToString("yyyy-MM-dd") }, { "endDate", EndDate?.ToString("yyyy-MM-dd") }, { "activityId", ActivityId?.ToString("D") }, { "clientProjectId", ClientProjectId?.ToString("D") } } .Where(x => x.Value != null) .ToDictionary(x => x.Key, x => x.Value)); }
public bool Equals(AssigneeLogsFilteredDto other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(AssigneeId.Equals(other.AssigneeId) && ActivityId.Equals(other.ActivityId) && LoggedTimeId.Equals(other.LoggedTimeId)); }
public void BatchReleaseIsRuledBySpecificPartitionPolicy() { // insert parts for an envelope that does have a partition-specific release policy BatchAdapter.AddPart(_envelopeSpecName, "p-one", ActivityId.NewActivityId(), "<data>some-partitioned-value</data>"); BatchAdapter.AddPart(_envelopeSpecName, "p-one", ActivityId.NewActivityId(), "<data>some-partitioned-value</data>"); var sut = BatchAdapter.ReleasePolicies.Single(); Assert.That(sut.EnvelopeId, Is.EqualTo(BatchAdapter.Envelopes.Single(e => e.SpecName == _envelopeSpecName).Id)); Assert.That(sut.Partition, Is.EqualTo("p-one")); Assert.That(sut.Enabled, Is.False); Assert.That(sut.ReleaseOnItemCount, Is.EqualTo(7)); }
public void ControlReleaseOneEnvelopeAndOnePartition() { BatchAdapter.AddPart(_envelopeSpecName, "partition-z", ActivityId.NewActivityId(), "<data>some-partitioned-value</data>"); BatchAdapter.CreateReleaseMessage(_envelopeSpecName, "partition-z").DropToFolder(DropFolders.INPUT_FOLDER, "release_batch.xml"); // batch controlled release process var process = TrackingRepository.SingleProcess( p => p.Name == Factory.Areas.Batch.Processes.Release && p.BeginTime > StartTime && p.Status == TrackingStatus.Completed && _envelopeSpecName.StartsWith(p.Value1) && p.Value3 == "partition-z"); process.SingleMessagingStep( s => s.Name == BizTalkFactoryApplication.ReceiveLocation <UnitTestInputMessageReceiveLocation>().Name && s.MessageType == new SchemaMetadata <Schemas.Xml.Batch.Release>().MessageType && s.Status == TrackingStatus.Received && _envelopeSpecName.StartsWith(s.Value1) && s.Value3 == "partition-z"); process.SingleMessagingStep( s => s.Name == BizTalkFactoryApplication.SendPort <BatchQueueControlledReleaseSendPort>().Name && s.MessageType == new SchemaMetadata <Schemas.Xml.Batch.Release>().MessageType && s.Status == TrackingStatus.Sent && _envelopeSpecName.StartsWith(s.Value1) && s.Value3 == "partition-z"); Assert.That(BatchAdapter.QueuedControlledReleases.Count(), Is.EqualTo(1)); BatchReleasePort.Enable(); // batch content handling process process = TrackingRepository.SingleProcess( p => p.Name == Default.Processes.Unidentified && p.BeginTime > StartTime && p.Status == TrackingStatus.Completed && _envelopeSpecName.StartsWith(p.Value1) && p.Value3 == "partition-z"); process.SingleMessagingStep( s => s.Name == BizTalkFactoryApplication.ReceiveLocation <BatchReceiveLocation>().Name // TODO && s.MessageType == new SchemaMetadata<BatchContent>().MessageType && s.Status == TrackingStatus.Received); var envelopeMessagingStep = process.SingleMessagingStep( s => s.Name == BizTalkFactoryApplication.SendPort <UnitTestBatchReleaseSendPort>().Name && s.Status == TrackingStatus.Sent && s.MessageType == new SchemaMetadata <Envelope>().MessageType && _envelopeSpecName.StartsWith(s.Value1) && s.Value3 == "partition-z"); Assert.That( envelopeMessagingStep.Message.Body, Is.EqualTo("<ns0:Envelope xmlns:ns0=\"urn:schemas.stateless.be:biztalk:envelope:2013:07\"><data>some-partitioned-value</data></ns0:Envelope>")); }
public async Task <IMediatorClientConnected <TRequestInner> > ConnectAndSendAsync <TRequestInner>( ActivityId activityId, TRequestInner request, ActivityExecutionConfiguration activityExecutionConfiguration, CancellationToken cancellationToken ) { var result = await this._MediatorScopeService.ConnectAsync(activityId, request, activityExecutionConfiguration, cancellationToken); this._LocalDisposables.Add(result); await result.SendAsync(cancellationToken); return(result); }
public bool Equals(ProjectGroupLogsDto other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(ProjectGroupId.Equals(other.ProjectGroupId) && ProjectId.Equals(other.ProjectId) && SprintId.Equals(other.SprintId) && ActivityId.Equals(other.ActivityId) && AssigneeId.Equals(other.AssigneeId) && LoggedTimeId.Equals(other.LoggedTimeId)); }
public void TestConvenienceInitializedStatement() { var mailbox = new Mailbox(new Uri("mailto:[email protected]")); var actor = new Agent(mailbox, "Example Learner"); var verb = new Verb(new VerbId("http://adlnet.gov/expapi/verbs/completed"), new LanguageMap(LanguageTag.EnglishUS, "completed")); var name = new LanguageMap(LanguageTag.EnglishUS, "Example Activity"); var description = new LanguageMap(LanguageTag.EnglishUS, "An example activity."); var theType = new Uri("http://adlnet.gov/expapi/activities/course"); var definition = new ActivityDefinition(name, description, theType); var activityId = new ActivityId("http://www.example.com/example-activity"); var activity = new Activity(activityId, definition); var statement = new Statement(actor, verb, activity); }
/// <inheritdoc/> public bool UseForVideoRecording(ActivityId videoRecording) { if (videoRecording == null) { throw new ArgumentNullException(nameof(videoRecording)); } if (IsAvailable()) { return AssumeRole(RoleInActivity.Recording(videoRecording)); } return false; }
private async Task ProcessCollectionControls(StandardConfigurationControlsCM collectionControls) { var fieldsPayloadCrate = Crate.FromContent(RuntimeFieldCrateLabelPrefix, new StandardPayloadDataCM(new KeyValueDTO[] { })); fieldsPayloadCrate.SourceActivityId = ActivityId.ToString(); Payload.Add(fieldsPayloadCrate); foreach (var controlDefinitionDTO in collectionControls.Controls) { ProcessCollectionControl(controlDefinitionDTO); } await ProcessFilePickers(collectionControls.Controls.Where(a => a.Type == ControlTypes.FilePicker)); }
public override int GetHashCode() { int hash = 1; if (UserId != 0) { hash ^= UserId.GetHashCode(); } if (ActivityId != 0) { hash ^= ActivityId.GetHashCode(); } hash ^= plotIds_.GetHashCode(); return(hash); }
internal static void ApplyEnvironment(this EventBase evt, IDictionary <string, object> env) { if (env == null) { throw new ArgumentNullException("env"); } var ctx = new OwinContext(env); evt.ActivityId = ActivityId.GetCurrentId(); evt.TimeStamp = DateTime.UtcNow; evt.ProcessId = Process.GetCurrentProcess().Id; evt.MachineName = Environment.MachineName; evt.RemoteIpAddress = ctx.Request.RemoteIpAddress; }
/// <inheritdoc/> public bool StopUsingForAudioRecording(ActivityId audioRecording) { if (audioRecording == null) { throw new ArgumentNullException(nameof(audioRecording)); } if (IsAudioRecording(audioRecording)) { MakeAvailable(); return true; } return false; }
/// <summary> /// Returns true if SummarySegmentEffort instances are equal /// </summary> /// <param name="other">Instance of SummarySegmentEffort to be compared</param> /// <returns>Boolean</returns> public bool Equals(SummarySegmentEffort other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( ActivityId == other.ActivityId || ActivityId != null && ActivityId.Equals(other.ActivityId) ) && ( ElapsedTime == other.ElapsedTime || ElapsedTime != null && ElapsedTime.Equals(other.ElapsedTime) ) && ( StartDate == other.StartDate || StartDate != null && StartDate.Equals(other.StartDate) ) && ( StartDateLocal == other.StartDateLocal || StartDateLocal != null && StartDateLocal.Equals(other.StartDateLocal) ) && ( Distance == other.Distance || Distance != null && Distance.Equals(other.Distance) ) && ( IsKom == other.IsKom || IsKom != null && IsKom.Equals(other.IsKom) )); }
public void ControlReleaseOneEnvelopeAndAllPartitions() { BatchAdapter.AddPart(_envelopeSpecName, null, ActivityId.NewActivityId(), "<data>some-partitioned-value</data>"); BatchAdapter.AddPart(_envelopeSpecName, "p-one", ActivityId.NewActivityId(), "<data>some-partitioned-value</data>"); BatchAdapter.AddPart(_envelopeSpecName, "p-two", ActivityId.NewActivityId(), "<data>some-partitioned-value</data>"); BatchAdapter.AddPart(_envelopeSpecName, "p-six", ActivityId.NewActivityId(), "<data>some-partitioned-value</data>"); BatchAdapter.AddPart("e-one", null, ActivityId.NewActivityId(), "<data>some-partitioned-value</data>"); BatchAdapter.AddPart("e-one", "p-one", ActivityId.NewActivityId(), "<data>some-partitioned-value</data>"); BatchAdapter.AddPart("e-one", "p-two", ActivityId.NewActivityId(), "<data>some-partitioned-value</data>"); BatchAdapter.AddPart("e-one", "p-six", ActivityId.NewActivityId(), "<data>some-partitioned-value</data>"); BatchAdapter.CreateReleaseMessage(_envelopeSpecName, "*").DropToFolder(DropFolders.INPUT_FOLDER, "release_batch.xml"); // batch controlled release process var process = TrackingRepository.SingleProcess( p => p.Name == Factory.Areas.Batch.Processes.Release && p.BeginTime > StartTime && p.Status == TrackingStatus.Completed && p.Status == TrackingStatus.Completed && _envelopeSpecName.StartsWith(p.Value1) && p.Value3 == "*"); process.SingleMessagingStep( s => s.Name == BizTalkFactoryApplication.ReceiveLocation <UnitTestInputMessageReceiveLocation>().Name && s.MessageType == new SchemaMetadata <Schemas.Xml.Batch.Release>().MessageType && s.Status == TrackingStatus.Received && _envelopeSpecName.StartsWith(s.Value1) && s.Value3 == "*"); process.SingleMessagingStep( s => s.Name == BizTalkFactoryApplication.SendPort <BatchQueueControlledReleaseSendPort>().Name && s.MessageType == new SchemaMetadata <Schemas.Xml.Batch.Release>().MessageType && s.Status == TrackingStatus.Sent && _envelopeSpecName.StartsWith(s.Value1) && s.Value3 == "*"); var queuedControlledReleases = BatchAdapter.QueuedControlledReleases.ToArray(); Assert.That( queuedControlledReleases.Count(), Is.EqualTo(4)); Assert.That( queuedControlledReleases.Select(qcr => qcr.EnvelopeId).Distinct().Single(), Is.EqualTo(BatchAdapter.Envelopes.Single(e => e.SpecName == _envelopeSpecName).Id)); Assert.That( queuedControlledReleases.Select(qcr => qcr.Partition), Is.EquivalentTo(new[] { "0", "p-one", "p-two", "p-six" })); }
public override int GetHashCode() { int hash = 1; if (ActivityId != 0) { hash ^= ActivityId.GetHashCode(); } hash ^= dropProgressMap_.GetHashCode(); hash ^= activeProgress_.GetHashCode(); if (DrawCount != 0) { hash ^= DrawCount.GetHashCode(); } return(hash); }
public void TrackActivityWhenBatchTrackingContextOnlyHasProcessActivityId() { var batchTrackingContext = new BatchTrackingContext { ProcessActivityId = ActivityId.NewActivityId() }; var sut = BatchReleaseProcessActivityTracker.Create(PipelineContextMock.Object, MessageMock.Object); sut.TrackActivity(batchTrackingContext); ActivityFactory.Verify(af => af.CreateProcess(It.IsAny <IBaseMessage>(), It.IsAny <string>()), Times.Never()); ActivityFactory.Verify(af => af.FindProcess(It.IsAny <string>()), Times.Never()); ProcessMock.Verify(p => p.TrackActivity(), Times.Never()); ProcessMock.Verify(p => p.AddSteps(It.IsAny <IEnumerable <string> >()), Times.Never()); }
public void PollForAvailableBatchesWithItemCountSizeLimit() { // drop more items than twice the item count limit, which is 3, so as to release two batches for (var i = 0; i < 8; i++) { BatchAdapter.AddPart(_envelopeSpecName, "p-count-limit", ActivityId.NewActivityId(), string.Format("<data>count-limit-value-{0}</data>", i)); } BatchReleasePort.Enable(); // batch content handling processes var processesQuery = TrackingRepository.Processes.Where( p => p.Name == Default.Processes.Unidentified && p.BeginTime > StartTime && p.Status == TrackingStatus.Completed && _envelopeSpecName.StartsWith(p.Value1) && p.Value3 == "p-count-limit"); // 2 processes have been tracked as more items than twice the item count limit have been accumulated Assert.That(() => processesQuery.Count(), Is.EqualTo(2).After(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(1))); var processes = processesQuery.ToArray(); // ensure the 2 processes are issued from the same polling, thereby validating that all available batches are // released in one shot (i.e., in DEV, one within one second of the other, when polling every 5 seconds) Assert.That(processes[0].BeginTime, Is.EqualTo(processes[1].BeginTime).Within(TimeSpan.FromSeconds(1))); // each batch is made of 3 parts var envelopeMessage1 = processes[0].MessagingSteps.Single( s => s.Name == BizTalkFactoryApplication.SendPort <UnitTestBatchReleaseSendPort>().Name && s.MessageType == new SchemaMetadata <Envelope>().MessageType && s.Status == TrackingStatus.Sent && _envelopeSpecName.StartsWith(s.Value1) && s.Value3 == "p-count-limit"); Assert.That(Regex.Matches(envelopeMessage1.Message.Body, @"<data>count-limit-value-\d</data>").Count, Is.EqualTo(3)); var envelopeMessage2 = processes[1].MessagingSteps.Single( s => s.Name == BizTalkFactoryApplication.SendPort <UnitTestBatchReleaseSendPort>().Name && s.MessageType == new SchemaMetadata <Envelope>().MessageType && s.Status == TrackingStatus.Sent && _envelopeSpecName.StartsWith(s.Value1) && s.Value3 == "p-count-limit"); Assert.That(Regex.Matches(envelopeMessage2.Message.Body, @"<data>count-limit-value-\d</data>").Count, Is.EqualTo(3)); // 2 parts have been left in the database Assert.That(BatchAdapter.Parts.Count(), Is.EqualTo(2)); }
public async Task Medaitor_9Monitor() { var servicesWebApp = new Microsoft.Extensions.DependencyInjection.ServiceCollection(); var servicesMediator = new Microsoft.Extensions.DependencyInjection.ServiceCollection(); servicesWebApp.AddLatransMedaitor() .AddActivityHandler <TestActivityHandler5>() .Build(); ActivityId activityId = ActivityId.NewId(); using (var serviceProviderMediator = servicesMediator.BuildServiceProvider()) { using (var serviceProviderWebApp = servicesWebApp.BuildServiceProvider()) { using (var scopeWebApp2 = serviceProviderWebApp.CreateScope()) { var scopedProviderWebApp2 = scopeWebApp2.ServiceProvider; var medaitorClient2 = scopedProviderWebApp2.GetRequiredService <IMediatorClientFactory>().GetMedaitorClient(); using (var scopeWebApp1 = serviceProviderWebApp.CreateScope()) { var scopedProviderWebApp1 = scopeWebApp1.ServiceProvider; var medaitorClient1 = scopedProviderWebApp1.GetRequiredService <IMediatorClientFactory>().GetMedaitorClient(); var activityExecutionConfiguration1 = scopedProviderWebApp1.GetRequiredService <ActivityExecutionConfigurationDefaults>().ForQueryCancelable; var request5 = new TestRequest5() { A = 6, B = 7 }; var connectedClient = await medaitorClient1.ConnectAsync( activityId, request5, activityExecutionConfiguration1, CancellationToken.None); // //medaitorClient2. // var activityResponse = await connectedClient.WaitForAsync(activityExecutionConfiguration1, CancellationToken.None); Assert.NotNull(activityResponse); Assert.NotNull(activityResponse as OkResultActivityResponse <TestResponse5>); Assert.Equal(6 * 7 + 1, ((OkResultActivityResponse <TestResponse5>)activityResponse).Result.R); } } } } }
public override int GetHashCode() { unchecked { var hashCode = (ProjectName != null ? ProjectName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (AssigneeName != null ? AssigneeName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ActivityName != null ? ActivityName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)ActivityStatus; hashCode = (hashCode * 397) ^ (ActivityType != null ? ActivityType.GetHashCode() : 0); hashCode = (hashCode * 397) ^ EstimatedTime.GetHashCode(); hashCode = (hashCode * 397) ^ LoggedTime.GetHashCode(); hashCode = (hashCode * 397) ^ ProjectId.GetHashCode(); hashCode = (hashCode * 397) ^ ActivityId.GetHashCode(); hashCode = (hashCode * 397) ^ AssigneeId.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { int hash = 1; if (ActivityId != 0) { hash ^= ActivityId.GetHashCode(); } if (MusicId != 0) { hash ^= MusicId.GetHashCode(); } if (MusicName.Length != 0) { hash ^= MusicName.GetHashCode(); } return(hash); }
internal void OnDeserializedMethod( StreamingContext context) { var components = ActivityId.Split(_activityIdSeparator, StringSplitOptions.RemoveEmptyEntries); if (components.Length > 0 && DateTime.TryParseExact(components[0], "yyyyMMddHHmmssfff", CultureInfo.InvariantCulture, DateTimeStyles.None, out var dateTime)) { ActivityDateTime = CustomTimeZone.ConvertFromEstToUtc(dateTime); } if (components.Length > 1 && Guid.TryParseExact(components[1], "D", out var guid)) { ActivityGuid = guid; } }
public override string ToString() { return(string.Format("{0} {1} {2} {3} {4} {5} {6} {7} {8} - {9} - {10}{11}", Source.Date.ToString("dd/MM/yyyy HH:mm:ss,fff").PadRight(24), Enum.GetName(typeof(LogLevel), Type).Trim().PadRight(12), Category.ToString().PadRight(14), Source.IdentityName.PadRight(15), Source.ProcessId.ToString().PadRight(6), Source.ThreadId.ToString().PadRight(6), Source.EventId.ToString().PadRight(4), String.IsNullOrWhiteSpace(ActivityId) ? string.Empty.PadRight(40) : ActivityId.PadRight(40), Source.TypeName, Source.MethodName, FullText, Environment.NewLine)); }
private static async Task InvokeServiceMethod() { ServiceProxyFactory proxyFactory = new ServiceProxyFactory( callbackClient => new MyServiceRemotingClientFactory(callbackClient)); ITestService testServiceProxy = proxyFactory.CreateServiceProxy <ITestService>(ServiceName); string activityId = ActivityId.GetOrCreateActivityId(); if (activityId == await testServiceProxy.GetCurrentActivityId()) { Console.WriteLine("Activity ID is {0}", activityId); } else { Console.WriteLine("Local Activity id doesnt match activity id returned by remote method"); } }
public override int GetHashCode() { int hash = 1; if (ActivityId != 0) { hash ^= ActivityId.GetHashCode(); } if (PlotId.Length != 0) { hash ^= PlotId.GetHashCode(); } if (OpenTime != 0L) { hash ^= OpenTime.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (UserId != 0) { hash ^= UserId.GetHashCode(); } if (ActivityId != 0) { hash ^= ActivityId.GetHashCode(); } if (BuyNum != 0) { hash ^= BuyNum.GetHashCode(); } return(hash); }
public void MessagingStepIsAffiliatedToProcess() { Dictionary <string, object> data = null; var processMessagingStepActivityId = string.Empty; var eventStream = new Mock <EventStream>(); eventStream .Setup(e => e.BeginActivity(nameof(ProcessMessagingStep), It.IsAny <string>())) .Callback <string, string>((n, i) => processMessagingStepActivityId = i); eventStream .Setup(es => es.UpdateActivity(nameof(ProcessMessagingStep), It.Is <string>(id => id == processMessagingStepActivityId), It.IsAny <object[]>())) .Callback <string, string, object[]>((n, id, d) => data = Enumerable.Range(0, d.Length / 2).ToDictionary(i => (string)d[i * 2], i => d[i * 2 + 1])) .Verifiable(); var pipelineContext = new Mock <IPipelineContext>(); pipelineContext.Setup(pc => pc.GetEventStream()).Returns(eventStream.Object); var message = new Unit.Message.Mock <IBaseMessage>(); message.Setup(m => m.GetProperty(ErrorReportProperties.ErrorType)).Returns(TrackingStatus.FailedMessage); var processActivityId = ActivityId.NewActivityId(); var sut = new Process(processActivityId, eventStream.Object); var messagingStep = new MessagingStep(pipelineContext.Object, message.Object); var messagingStepActivityId = messagingStep.ActivityId; sut.AddStep(messagingStep); eventStream.Verify(); eventStream.Verify(s => s.BeginActivity(nameof(ProcessMessagingStep), processMessagingStepActivityId), Times.Once()); eventStream.Verify(s => s.UpdateActivity(nameof(ProcessMessagingStep), processMessagingStepActivityId, It.IsAny <object[]>()), Times.Once()); eventStream.Verify(s => s.Flush(), Times.Once()); eventStream.Verify(s => s.EndActivity(nameof(ProcessMessagingStep), processMessagingStepActivityId), Times.Once()); var expectedData = new Dictionary <string, object> { { nameof(ProcessMessagingStep.MessagingStepActivityID), messagingStepActivityId }, // capture of Status is what distinguishes affiliation of a MessagingStep from affiliation of a MessagingStepReference { nameof(ProcessMessagingStep.MessagingStepStatus), TrackingStatus.FailedMessage }, { nameof(ProcessMessagingStep.ProcessActivityID), processActivityId } }; data.Should().BeEquivalentTo(expectedData); }
bool IsAudioRecording(ActivityId audioRecording) { return IsInRole(RoleInActivity.Recording(audioRecording)); }
// copy-constructor internal ActivityId(ActivityId activity) { this.Id = activity.Id; this.Sequence = activity.Sequence; }