private SubscriptionManager GetSubscriptionManager(SubscribeOption subscribe) { var workQueue = new Mock <IQueue>(); workQueue.Setup(m => m.Uri).Returns(new Uri(WorkQueueUri)); var serviceBusConfiguration = new ServiceBusConfiguration { Inbox = new InboxQueueConfiguration { WorkQueue = workQueue.Object } }; var subscriptionConfiguration = SubscriptionSection.Configuration(); subscriptionConfiguration.Subscribe = subscribe; var serviceBusEvents = new ServiceBusEvents(); var subscriptionManager = new SubscriptionManager(serviceBusEvents, serviceBusConfiguration, subscriptionConfiguration, new ScriptProvider(new ScriptProviderConfiguration()), DatabaseContextFactory, DatabaseGateway); serviceBusEvents.OnStarted(this, new PipelineEventEventArgs(new Mock <IPipelineEvent>().Object)); return(subscriptionManager); }
public void SubscribeStudent(AddSubscriptionDTO addSubscriptionDto) { var subscription = GetSubscription(addSubscriptionDto.UserId); var subscriptionSections = new List <SubscriptionSection>(); foreach (var vSection in addSubscriptionDto.Sections) { var section = _context.Sections.ToList().First(x => x.Id == vSection); var subscriptionSection = new SubscriptionSection(); subscriptionSection.SubscriptionId = subscription.Id; subscriptionSection.SectionId = vSection; subscriptionSection.StatusId = 3; subscriptionSection.Section = section; subscriptionSection.CreatedAt = DateTime.Now; if (subscriptionSections.Any(x => x.Section.SubjectId == section.SubjectId)) { throw new Exception("No puede seleccion dos secciones de la misma materia"); } subscriptionSections.Add(subscriptionSection); } _context.SubscriptionSections.AddRange(subscriptionSections); _context.SaveChanges(); }
public static void AddSubscription(string Serial, string SubscriptionPath, SubscriptionSection subscriptionSection) { #pragma warning disable CS0162 if (isLogging) { Debug.Log(TAG + "AddSubscription, serial: " + Serial + ", SubscriptionPath: " + SubscriptionPath + ", Samplerate: " + subscriptionSection.Samplerate); } #pragma warning restore CS0162 for (int i = 0; i < _movesenseDevices.Count; i++) { if (_movesenseDevices[i].Serial == Serial) { // check, if key already exist if (_movesenseDevices[i].Subscriptions.ContainsKey(SubscriptionPath)) { Debug.LogWarning(TAG + "AddSubscription: SubscriptionPath " + SubscriptionPath + " is already subscribed"); } else { #pragma warning disable CS0162 if (isLogging) { Debug.Log(TAG + "AddSubscription: " + _movesenseDevices[i].MacID + " (" + _movesenseDevices[i].Serial + "), Type: " + SubscriptionPath); } #pragma warning restore CS0162 _movesenseDevices[i].Subscriptions.Add(SubscriptionPath, subscriptionSection); } return; } } Debug.LogWarning(TAG + "AddSubscription: " + Serial + " is not available"); }
public void Should_be_able_to_get_configuration() { var configuration = SubscriptionSection.Configuration(); Assert.IsNotNull(configuration); }