示例#1
0
        private void GetEventIds()
        {
            var enm2 = System.IO.Directory.EnumerateFiles("..//..//..//Smarkets.EF6App//Data", "*.sqlite", System.IO.SearchOption.AllDirectories)
                       .Select(_ => (new SQLite.SQLiteAsyncConnection(_).Table <Match>().ToListAsync()).ToObservable())
                       .ToObservable()
                       .SubscribeOn(System.Reactive.Concurrency.DefaultScheduler.Instance)
                       .SelectMany(_ => _.Select(a => a.First().EventId.ToString()));

            enm2.ObserveOnDispatcher().Subscribe(_ => Collection2.Add(_));
        }
示例#2
0
        TypeData MakeGenericTypeData(IReadOnlyList <TypeData> parameters)
        {
            if (!IsSupported)
            {
                return(this);
            }

            if (IsGenericParameter)
            {
                return(parameters[this.GenericParameterIndex]);
            }

            if (!IsGeneric)
            {
                return(this);
            }

            var result = new TypeData()
            {
                IsSupported             = true,
                Kind                    = Kind,
                IsSealed                = IsSealed,
                IsReference             = IsReference,
                IsEnum                  = IsEnum,
                IsInterface             = IsInterface,
                HasConverter            = HasConverter,
                IsISerializable         = IsISerializable,
                IsGeneric               = true,
                IsGenericTypeDefinition = false,
                IsNullable              = IsNullable,
                Element                 = this,
                GenericParameters       = GenericParameters.Select(x => x.MakeGenericTypeData(parameters)).ToList().AsReadOnly(),
            };

            result.BaseType  = BaseType?.MakeGenericTypeData(parameters);
            result.Surrogate = Surrogate?.MakeGenericTypeData(parameters);

            if (Surrogate == null &&
                !IsInterface &&
                !IsArray && !IsEnum &&
                !IsGenericParameter)
            {
                foreach (var m in Members)
                {
                    var rm = new Member(result);
                    rm.Name = m.Name;
                    rm.Type = m.Type.MakeGenericTypeData(parameters);
                    result.Members.Add(rm);
                }
                result.CollectionType = CollectionType;
                result.Collection1    = Collection1?.MakeGenericTypeData(parameters);
                result.Collection2    = Collection2?.MakeGenericTypeData(parameters);
            }
            return(result);
        }
示例#3
0
        public void RightOuterJoin_ReturnsJoin_OnKey()
        {
            var result = Collection1.GetMe().RightOuterJoin(Collection2.GetMe(), x => x.Id, y => y.Id, (i, j) => new { Id = j.Id, i?.Name, j?.Description });

            Assert.True(result.Count() == 4);

            var bob = result.First();

            Assert.True(bob.Id == 1 && bob.Name == "Bob" && bob.Description == "Blue");

            var black = result.Last();

            Assert.True(black.Id == 5 && black.Name == null && black.Description == "Black");
        }
示例#4
0
        public void LeftOuterJoin_ReturnsJoin_OnKey()
        {
            var result = Collection1.GetMe().LeftOuterJoin(Collection2.GetMe(), x => x.Id, y => y.Id, (i, j) => new { Id = i.Id, i?.Name, j?.Description });

            Assert.True(result.Count() == 4);

            var bob = result.First();

            Assert.True(bob.Id == 1 && bob.Name == "Bob" && bob.Description == "Blue");

            var sue = result.Last();

            Assert.True(sue.Id == 4 && sue.Name == "Sue" && sue.Description == null);
        }
        /// <summary>
        /// Determines whether the specified HeadEndSystemSettingsCollections are equal.
        /// </summary>
        /// <param name="Collection1">The first HeadEndSystemSettingsCollection to compare.</param>
        /// <param name="Collection2">The second HeadEndSystemSettingsCollection to compare.</param>
        /// <returns>
        /// true if the first HeadEndSystemSettingsCollection is equal to the second
        /// HeadEndSystemSettingsCollection; otherwise, false.
        /// </returns>
        //  Revision History
        //  MM/DD/YY Who Version Issue# Description
        //  -------- --- ------- ------ -------------------------------------------
        //  04/22/13 jrf 2.80.22 TQ8285 Created
        //
        public static bool operator ==(HeadEndSystemSettingsCollection Collection1, HeadEndSystemSettingsCollection Collection2)
        {
            bool blnEquals = false;

            // If both are null, or both are same instance, return true.
            if (System.Object.ReferenceEquals(Collection1, Collection2))
            {
                blnEquals = true;
            }
            // If one is null, but not both, return false.
            else if (((object)Collection1 == null) || ((object)Collection2 == null))
            {
                blnEquals = false;
            }
            else
            {
                // Return true if the collections have the same number of elements and every element from one is contained in the other.
                blnEquals = true;

                if (Collection1.Count == Collection2.Count)
                {
                    foreach (HeadEndSystemSettings HeadEndSystem in Collection1)
                    {
                        //if just one system is not contained in the other, not equal
                        if (false == Collection2.Contains(HeadEndSystem))
                        {
                            blnEquals = false;
                            break; //no need to check any more.
                        }
                    }
                }
                else //different number of elememnts, not equal
                {
                    blnEquals = false;
                }
            }

            return(blnEquals);
        }