Exemplo n.º 1
0
        public async Task use_type_filters()
        {
            NumberOfStreams = 10;
            await PublishSingleThreaded();

            using var fetcher1 = new EventFetcher(theStore, theStore.Tenancy.Default.Database, new ISqlFragment[0]);

            var shardName = new ShardName("name");
            var range1    = new EventRange(shardName, 0, NumberOfEvents);
            await fetcher1.Load(range1, CancellationToken.None);

            var uniqueTypeCount = range1.Events.Select(x => x.EventType).Distinct()
                                  .Count();

            uniqueTypeCount.ShouldBe(5);

            var filter = new EventTypeFilter(theStore.Events, new Type[] { typeof(Travel), typeof(Arrival) });

            using var fetcher2 = new EventFetcher(theStore, theStore.Tenancy.Default.Database, new ISqlFragment[] { filter });

            var range2 = new EventRange(shardName, 0, NumberOfEvents);
            await fetcher2.Load(range2, CancellationToken.None);

            range2.Events
            .Select(x => x.EventType)
            .OrderBy(x => x.Name).Distinct()
            .ShouldHaveTheSameElementsAs(typeof(Arrival), typeof(Travel));
        }
Exemplo n.º 2
0
        internal async Task executeAfterLoadingEvents(Action <IEventStore> loadEvents)
        {
            loadEvents(theSession.Events);
            await theSession.SaveChangesAsync();

            var fetcher = new EventFetcher(theStore, theStore.Tenancy.Default.Database, theFilters.ToArray());
            await fetcher.Load(theRange, default);
        }
Exemplo n.º 3
0
        public override void Given()
        {
            base.Given();

            EventFetcher.Setup(x => x.Fetch(It.IsAny <CancellationToken>())).Returns(() => Task.FromResult <IEnumerable <EpcisEvent> >(new[] { new EpcisEvent(), new EpcisEvent() }));
            Parameters.Add(new Model.Queries.QueryParameter {
                Name = "maxEventCount", Values = new[] { "1" }
            });
        }
        public async Task event_fetcher_simple_case()
        {
            using var fetcher = new EventFetcher(theStore, new ISqlFragment[0]);

            NumberOfStreams = 10;
            await PublishSingleThreaded();

            var range1 = new EventRange(new ShardName("name"), 0, 10);
            await fetcher.Load(range1, CancellationToken.None);

            var range2 = new EventRange(new ShardName("name"), 10, 20);
            await fetcher.Load(range2, CancellationToken.None);

            var range3 = new EventRange(new ShardName("name"), 20, 38);
            await fetcher.Load(range3, CancellationToken.None);

            range1.Events.Count.ShouldBe(10);
            range2.Events.Count.ShouldBe(10);
            range3.Events.Count.ShouldBe(18);
        }
Exemplo n.º 5
0
        public async void Execute(object parameter)
        {
            var app = App.PublicClientApp;

            InteractiveAuthenticationProvider authProvider = new InteractiveAuthenticationProvider(app, new string[] { "Calendars.Read" });

            GraphServiceClient graphClient = new GraphServiceClient(authProvider);

            EventFetcher            eventFetcher = new EventFetcher(graphClient);
            IEnumerable <WorkEntry> events       = new List <WorkEntry>();

            try
            {
                events = await eventFetcher.GetDaysEventsAsync(_dataContext.TodayDate);
            }
            catch { }

            _dataContext.WorkEntries = new ObservableCollection <WorkEntry>(_dataContext.WorkEntries.Where(x => x.Source != "Outlook"));

            foreach (var item in events)
            {
                _dataContext.WorkEntries.Add(item);
            }
        }
Exemplo n.º 6
0
 public void ItShouldCallTheEventFetcherApplyMethodWithSimpleParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <SimpleParameterFilter <int> >(f => f.Field == EpcisField.RequestId && f.Values.Any(v => v == 6))), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithSimpleParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <SimpleParameterFilter <string> >(f => f.Field == EpcisField.TransformationId && f.Values.Any(v => v.ToString() == "test_trID"))), Times.Once);
 }
Exemplo n.º 8
0
 public void ItShouldCallTheEventFetcherApplyMethodWithSourceDestinationFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <SourceDestinationFilter>(f => f.Type == SourceDestinationType.Source && f.Name == "sourceName" && f.Values.Any(v => v.ToString() == "test_source"))), Times.Once);
 }
Exemplo n.º 9
0
 public void ItShouldCallTheEventFetcherApplyMethodWithComparisonCustomFieldParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <ComparisonCustomFieldFilter>(f => f.Field.Namespace == "namespace" && f.Field.Name == "name" && f.Comparator == FilterComparator.LessThan && f.IsInner == false && f.Value.ToString() == "15")), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithMatchEpcFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <MatchEpcFilter>(f => f.EpcType.Contains(EpcType.OutputEpc) && f.Values.Any(v => v.ToString() == "epc_value"))), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithExistsErrorDeclarationFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.IsAny <ExistsErrorDeclarationFilter>()), Times.Once);
 }
Exemplo n.º 12
0
 public void ItShouldCallTheEventFetcherApplyMethodWithSourceDestinationFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <ExistCustomFieldFilter>(f => f.IsInner == true && f.Field.Namespace == "namespaceInner" && f.Field.Name == "name" && f.Field.Type == FieldType.Ilmd)), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithOrderDirectionFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <OrderDirectionFilter>(f => f.Direction == OrderDirection.Ascending)), Times.Once);
 }
Exemplo n.º 14
0
 public void ItShouldCallTheEventFetcherApplyMethodWithMasterdataHierarchyFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <MasterdataHierarchyFilter>(f => f.Field == EpcisField.BusinessLocation && f.Values.Any(v => v.ToString() == "loc_id"))), Times.Once);
 }
Exemplo n.º 15
0
 public void ItShouldCallTheEventFetcherApplyMethodWithOrderFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <OrderFilter>(f => f.Field == EpcisField.BusinessLocation)), Times.Once);
 }
Exemplo n.º 16
0
 public void ItShouldCallTheEventFetcherApplyMethodWithSourceDestinationFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <QuantityFilter>(f => f.Operator == FilterComparator.LessThan && f.Value == 38)), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithComparisonParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <ComparisonParameterFilter>(f => f.Comparator == FilterComparator.GreaterOrEqual && f.Field == EpcisField.RecordTime && f.Value is DateTime)), Times.Once);
 }
Exemplo n.º 18
0
 public void ItShouldCallTheEventFetcherApplyMethodWithSourceDestinationFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <ComparisonCustomFieldFilter>(f => f.IsInner == false && f.Comparator == FilterComparator.LessOrEqual && f.Field.Namespace == "namespace" && f.Field.Name == "ilmd" && f.Field.Type == FieldType.Ilmd && (double)f.Value == 15)), Times.Once);
 }
Exemplo n.º 19
0
 public void ItShouldCallTheEventFetcherApplyMethodWithComparisonCustomFieldParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <AttributeFilter>(f => f.Field == EpcisField.BusinessLocation && f.AttributeName == "attributeName" && f.Values.Single() == "some value")), Times.Once);
 }
Exemplo n.º 20
0
 public void ItShouldCallTheEventFetcherApplyMethodWithSourceDestinationFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <CustomFieldFilter>(f => f.IsInner == false && f.Field.Namespace == "namespace" && f.Field.Name == "ilmd" && f.Field.Type == FieldType.Ilmd && f.Values.Contains("expected"))), Times.Once);
 }
Exemplo n.º 21
0
 public void ItShouldCallTheEventFetcherApplyMethodWithComparisonParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <SimpleParameterFilter <EventAction> >(f => f.Field == EpcisField.Action && f.Values.Any(v => v.ToString() == "ADD"))), Times.Once);
 }
Exemplo n.º 22
0
 public void ItShouldCallTheEventFetcherApplyMethodWithEqualsErrorReasonFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <EqualsErrorReasonFilter>(f => f.Values.Any(v => v.ToString() == "reason"))), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithSimpleParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <SimpleParameterFilter <EventType> >(f => f.Field == EpcisField.EventType && f.Values.Any(v => v.ToString() == "ObjectEvent"))), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithSimpleParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <SimpleParameterFilter <string> >(f => f.Field == EpcisField.ReadPoint && f.Values.Any(v => v.ToString() == "read_point"))), Times.Once);
 }
Exemplo n.º 25
0
 public void ItShouldCallTheEventFetcherApplyMethodWithEqualsCorrectiveEventIdFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <EqualsCorrectiveEventIdFilter>(f => f.Values.Any(v => v.ToString() == "evt_id"))), Times.Once);
 }
Exemplo n.º 26
0
 public void ItShouldCallTheEventFetcherApplyMethodWithComparisonParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <SimpleParameterFilter <string> >(f => f.Field == EpcisField.BusinessStep && f.Values.Any(v => v.ToString() == "urn:fastnt:demo:bizstep:demo:packing"))), Times.Once);
 }
Exemplo n.º 27
0
 public void ItShouldCallTheEventFetcherApplyMethodWithSourceDestinationFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <ComparisonCustomFieldFilter>(f => f.IsInner == true && f.Comparator == FilterComparator.GreaterThan && f.Field.Namespace == "namespace" && f.Field.Name == "ilmd" && f.Field.Type == FieldType.Ilmd && (DateTime)f.Value == new DateTime(2019, 08, 24, 10, 05, 02, DateTimeKind.Utc))), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithComparisonParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <SimpleParameterFilter <string> >(f => f.Field == EpcisField.Disposition && f.Values.Any(v => v.ToString() == "urn:epcglobal:cbv:disp:loading"))), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithLimitFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <LimitFilter>(f => f.Value == 6)), Times.Once);
 }
Exemplo n.º 30
0
 public void ItShouldCallTheEventFetcherApplyMethodWithSourceDestinationFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <BusinessTransactionFilter>(f => f.TransactionType == "bizTransType" && f.Values.Any(v => v.ToString() == "test_biztrans"))), Times.Once);
 }