Beispiel #1
0
        public SpriteScenecontrolData(Sprite startSprite)
        {
            this.startSprite = startSprite;

            imageKeys     = new IndexedList <ControlValueKey <Sprite> >();
            sortLayerKeys = new IndexedList <ControlValueKey <int> >();
        }
Beispiel #2
0
        public void IndexedListAddShouldAddToList()
        {
            var indexedList = new IndexedList <int>();

            indexedList.Add(0);
            Assert.AreEqual(1, indexedList.Count);
        }
Beispiel #3
0
        public Grammar(
            INonTerminal start,
            IReadOnlyList <IProduction> productions,
            IReadOnlyList <ILexerRule> ignoreRules,
            IReadOnlyList <ILexerRule> triviaRules)
        {
            _productions = new IndexedList <IProduction>();
            _ignores     = new IndexedList <ILexerRule>();
            _trivia      = new IndexedList <ILexerRule>();

            _transativeNullableSymbols = new UniqueList <INonTerminal>();
            _symbolsReverseLookup      = new Dictionary <INonTerminal, UniqueList <IProduction> >();
            _lexerRules = new IndexedList <ILexerRule>();
            _leftHandSideToProductions = new Dictionary <INonTerminal, List <IProduction> >();
            _dottedRuleRegistry        = new DottedRuleRegistry();
            _symbolPaths = new Dictionary <ISymbol, UniqueList <ISymbol> >();

            Start = start;
            AddProductions(productions ?? EmptyProductionArray);
            AddIgnoreRules(ignoreRules ?? EmptyLexerRuleArray);
            AddTriviaRules(triviaRules ?? EmptyLexerRuleArray);

            _rightRecursiveSymbols = CreateRightRecursiveSymbols(_dottedRuleRegistry, _symbolPaths);
            FindNullableSymbols(_symbolsReverseLookup, _transativeNullableSymbols);
        }
Beispiel #4
0
 public Item(ItemId id = null, Fingerprint fingerprint = null, List<Statement> statements = null, List<SiteLink> sitelinks = null)
 {
     Id = id;
     Fingerprint = fingerprint == null ? new Fingerprint() : fingerprint;
     Statements = statements == null ? new List<Statement>() : statements;
     Sitelinks = new IndexedList<string, SiteLink>(siteLink => siteLink.SiteId, sitelinks);
 }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            IndexedList indexedList = null;

            while (reader.Read())
            {
                if (reader.TokenType != JsonToken.PropertyName)
                {
                    break;
                }

                var propertyName = (string)reader.Value;
                if (!reader.Read())
                {
                    continue;
                }

                if (propertyName == "Apps")
                {
                    indexedList = new IndexedList(serializer.Deserialize <HashSet <Index> >(reader));
                }
            }

            return(indexedList == null? new IndexedList() : indexedList);
        }
Beispiel #6
0
 public Background(Texture2D particleTexture, Rectangle area)
 {
     this.particleTexture = particleTexture;
     this.particles       = new IndexedList <Particle>();
     this.random          = new Random();
     this.area            = area;
     this.density         = 128d / (1280d * 720d);
 }
        public void TestFromList()
        {
            IndexedList<string, SiteLink> list = new IndexedList<string, SiteLink> (
                siteLink => siteLink.SiteId,
                new List<SiteLink> { new SiteLink("enwiki", "Foo") }
            );

            Assert.Equal("Foo", list["enwiki"].PageName);
        }
Beispiel #8
0
 public Board(string name, string desc, int id)
 {
     BoardId = id;
     Lists = new IndexedList<BoardList>();
     Cards = new Dictionary<int, BoardCard>();
     Archived = new Dictionary<int, BoardCard>();
     Description = desc;
     Name = name;
 }
        public void TestAccessNotExisting()
        {
            IndexedList<string, SiteLink> list = new IndexedList<string, SiteLink>(siteLink => siteLink.SiteId) {
                new SiteLink("enwiki", "Foo"),
                new SiteLink("dewiki", "Bar")
            };

            Assert.Throws<KeyNotFoundException>(() => list["xxwiki"]);
        }
        public void TestAdd()
        {
            IndexedList<string, SiteLink> list = new IndexedList<string, SiteLink> (siteLink => siteLink.SiteId) {
                new SiteLink("enwiki", "Foo")
            };
            list.Add(new SiteLink("dewiki", "Bar"));

            Assert.Equal("Foo", list["enwiki"].PageName);
            Assert.Equal("Bar", list["dewiki"].PageName);
        }
Beispiel #11
0
        /// <summary>
        /// Очистить кэш
        /// </summary>
        public void Clear()
        {
            //Обнуляем текущий размер кэша
            _currentCacheSize = 0;

            //Создаём словарь поиска объектов по id и их хранения
            _objects = new Dictionary <Int64, CachedObject>(MIN_CACHE_COUNT);
            //Создаём список истории объектов
            _objectsHistory = new IndexedList <Int64>(MIN_CACHE_COUNT);
        }
Beispiel #12
0
        private static IndexedList <int> CreateListForRange(int min, int max)
        {
            var indexedList = new IndexedList <int>();

            for (var i = min; i <= max; i++)
            {
                indexedList.Add(i);
            }
            return(indexedList);
        }
Beispiel #13
0
        public CollisionDetectionSystem(EntityWorld entityWorld)
        {
            this.entityWorld       = entityWorld;
            this.UseSpatialHashing = true;
            this.targets           = new IndexedList <Entity>();
            this.spatialGrid       = new SpatialGrid <Entity>(GameConfig.CellSize, GameConfig.NumCells);
            this.checkedPairs      = new HashSet <ulong>();

            this.DesiredComponentIds = entityWorld.ComponentManager.GetComponentId <CollidableComponent>() | entityWorld.ComponentManager.GetComponentId <TransformComponent>();
        }
Beispiel #14
0
        /// <summary>
        /// Return a list of message recieved since the last time it was caled.
        /// </summary>
        /// <returns> List of ChatEntry </returns>
        public static List <LokiPoe.InGameState.ChatPanel.ChatEntry> GetNewChatMessages()
        {
            var tempMsg = LokiPoe.InGameState.ChatPanel.Messages;
            var result  = new IndexedList <LokiPoe.InGameState.ChatPanel.ChatEntry>();

            result.AddRange(tempMsg.Where(msg => !_oldMessages.Contains(msg)));

            _oldMessages = tempMsg;

            return(result);
        }
Beispiel #15
0
 public Domain(string name, IEnumerable <string> values) : base(name)
 {
     Values = new IndexedList <IndexedNamedItem>();
     if (values != null)
     {
         foreach (var value in values)
         {
             Values.Add(new IndexedNamedItem(value));
         }
     }
 }
Beispiel #16
0
        public SplitArray(int sizeX, int sizeY)
        {
            LengthX = sizeX;
            LengthY = sizeY;
            _nodes  = new IndexedList <T[]>(sizeX);

            for (int ix = 0; ix < sizeX; ++ix)
            {
                _nodes.Add(new T[sizeY]);
            }
        }
Beispiel #17
0
 public KnowledgeBase(string name = null)
 {
     if (name == null)
     {
         name = "New knowledge base";
     }
     Name      = name;
     Domains   = new IndexedList <Domain>();
     Variables = new IndexedList <Variable>();
     Rules     = new IndexedList <Rule>();
 }
Beispiel #18
0
    static object Solve()
    {
        var n  = int.Parse(Console.ReadLine());
        var s0 = Console.ReadLine().Select(c => c == 'B').ToArray();
        var t  = Console.ReadLine().Select(c => c == 'B').ToArray();

        var s = new IndexedList <bool>();

        foreach (var v in s0)
        {
            s.Add(v);
        }

        var r = 0L;
        // 先行インデックス
        var q = 0;

        for (int i = 0; i < n; i++)
        {
            var v = s[i];
            if (v == t[i])
            {
                continue;
            }

            if (i == n - 1)
            {
                return(-1);
            }

            q = Math.Max(q, i);
            while (q + 1 < n && s[q] != s[q + 1])
            {
                q++;
            }
            if (q == n - 1)
            {
                return(-1);
            }

            r += q - i + 1;
            s.RemoveAt(q);
            s.RemoveAt(q);
            s.Insert(i, !v);
            s.Insert(i, !v);
        }

        if (!s.SequenceEqual(t))
        {
            throw new InvalidOperationException();
        }

        return(r);
    }
Beispiel #19
0
 public Domain(string name, IndexedList <IndexedNamedItem> values = null) : base(name)
 {
     if (values == null)
     {
         Values = new IndexedList <IndexedNamedItem>();
     }
     else
     {
         Values = values;
     }
 }
		public void should_be_able_to_get_an_item_using_an_index()
		{
			var sut = new IndexedList<ShopItem>();
			
			var item = new ShopItem { Id = 1, Name = "Megaphone", Price = 200m }; 
			
			sut.Add(item);

			var result = sut.GetItem(0);

			Assert.That(result, Is.EqualTo(item));
		}
        public void should_be_able_to_get_an_item_using_an_index()
        {
            var sut = new IndexedList <ShopItem>();

            var item = new ShopItem {
                Id = 1, Name = "Megaphone", Price = 200m
            };

            sut.Add(item);

            var result = sut.GetItem(0);

            Assert.That(result, Is.EqualTo(item));
        }
Beispiel #22
0
        public void TestAddRemoveAndClearMethods()
        {
            var sut = new IndexedList <ItemMetadata>();

            sut.AddIndex("Idx", metadata => metadata.BlobRef);

            var item1 = new ItemMetadata
            {
                BlobRef = Guid.NewGuid().ToString(),
                Name    = "Tag",
                Value   = "Cuba"
            };

            var item2 = new ItemMetadata
            {
                BlobRef = Guid.NewGuid().ToString(),
                Name    = "Tag",
                Value   = "beach"
            };

            var item3 = new ItemMetadata
            {
                BlobRef = Guid.NewGuid().ToString(),
                Name    = "Tag",
                Value   = "pooltable"
            };

            Assert.That(sut.Count, Is.EqualTo(0));

            sut.Add(item1);

            Assert.That(sut.Count, Is.EqualTo(1));

            sut.Add(item2);

            Assert.That(sut.Count, Is.EqualTo(2));

            sut.Insert(1, item3);
            Assert.That(sut.Count, Is.EqualTo(3));

            sut.RemoveAt(2);

            Assert.That(sut.Count, Is.EqualTo(2));
            Assert.That(sut[0].Value, Is.EqualTo("Cuba"));

            sut.Clear();

            Assert.That(sut.Count, Is.EqualTo(0));
        }
Beispiel #23
0
        public PositionCache(ILogger <PositionCache> logger, IServiceScopeFactory scopeFactory, DeviceCache deviceCache)
        {
            _scopeFactory = scopeFactory;
            _logger       = logger;
            _positions    = new();
            _deviceCache  = deviceCache;

            _timer = new Timer()
            {
                AutoReset = true,
                Interval  = TimeSpan.FromMinutes(5).TotalMilliseconds,
            };
            _timer.Elapsed += PersistPositionsEvent;
            _timer.Start();
        }
Beispiel #24
0
        public void CleanIndexes()
        {
            _triplesByLeft = new IndexedList <string, Triple>();
            _triplesByLeftInstructionKey     = new IndexedList <string, Triple>();
            _triplesByLeftObjectKeyMember    = new IndexedList <string, Triple>();
            _triplesByLeftInstanceOwnerKey   = new IndexedList <string, Triple>();
            _leftConstructorTriplesByTypeKey = new IndexedList <string, Triple>();

            _triplesByRight = new IndexedList <string, Triple>();
            _triplesByRightInstructionKey   = new IndexedList <string, Triple>();
            _triplesByRightObjectKeyMember  = new IndexedList <string, Triple>();
            _triplesByRightInstanceOwnerKey = new IndexedList <string, Triple>();
            _objectInitializerTriplesByRightByConstructorInstructionKey = new IndexedList <string, Triple>();

            _triplesHashset = new HashSet <Triple>();
        }
Beispiel #25
0
        private Vector3 GetFurthestPathPosition(IndexedList <Vector3> path, float maxDistance, RayType type, bool updatePath)
        {
            if (path == null || path.Count == 0)
            {
                return(Vector3.Zero);
            }

            Vector3 startPosition       = Core.Player.Position;
            Vector3 reachablePosition   = startPosition;
            Vector3 unreachablePosition = path.LastOrDefault();

            // Find closest valid path point;
            for (int i = path.Index; i < path.Count; i++)
            {
                var point = path[i];
                if (startPosition.Distance(point) > maxDistance || type == RayType.Cast && !CanRayCast(startPosition, point) || type == RayType.Walk && !CanRayWalk(startPosition, point))
                {
                    if (updatePath)
                    {
                        path.Index = i;
                    }
                    unreachablePosition = point;
                    break;
                }
                reachablePosition = point;
            }

            var         distance          = reachablePosition.Distance(unreachablePosition);
            const float incrementDistance = 2f;
            var         totalSegments     = distance / incrementDistance;

            // Find closest valid portion of path.
            for (int i = 0; i < totalSegments; i++)
            {
                var point = MathEx.CalculatePointFrom(unreachablePosition, reachablePosition, i * incrementDistance);
                if (startPosition.Distance(point) > maxDistance || type == RayType.Cast && !CanRayCast(startPosition, point) || type == RayType.Walk && !CanRayWalk(startPosition, point))
                {
                    break;
                }

                reachablePosition = point;
            }

            return(reachablePosition);
        }
Beispiel #26
0
        /// <summary>
        /// Attribute categories
        /// </summary>
        /// <returns><c>Bag</c> of Attribute Categories</returns>
        internal static Bag<DgmAttributeCategory> AttributeCategories()
        {
            var list = new IndexedList<DgmAttributeCategory>();

            foreach (dgmAttributeCategories category in Context.dgmAttributeCategories)
            {
                var item = new DgmAttributeCategory
                               {
                                   ID = category.categoryID,
                                   Description = category.categoryDescription.Clean(),
                                   Name = category.categoryName.Clean()
                               };

                list.Items.Add(item);
            }

            return new Bag<DgmAttributeCategory>(list);
        }
        protected float GetAxis(IndexedList <ControlAxisKey> keys, int time, float defvalue = default)
        {
            while (keys.HasNext && time < keys.Current.timing)
            {
                keys.index++;
            }

            if (!keys.HasNext)
            {
                return(keys.Current.targetValue);
            }

            if (keys.HasPrevious)
            {
                return((keys.Current.targetValue - defvalue) * ((float)time / keys.Current.timing));
            }

            return(math.lerp(keys.Previous.targetValue, keys.Current.targetValue, Easing.Do(math.unlerp(keys.Previous.timing, keys.Current.timing, time), keys.Previous.easing)));
        }
Beispiel #28
0
        /// <summary>
        /// Order all of the portal scenes and work out where we are within that sequence.
        /// </summary>
        public static IndexedList <DeathGateScene> CreateSequence()
        {
            var gateScene = NearestGateScene;

            if (gateScene == null || gateScene.Distance > 800)
            {
                return(new IndexedList <DeathGateScene>());
            }

            var sequence = new IndexedList <DeathGateScene>(CurrentRegionScenes.OrderByDescending(p => p.Depth));

            while (sequence.CurrentOrDefault != null && sequence.Current.SnoId != gateScene.SnoId)
            {
                sequence.Next();
            }

            Core.Logger.Debug($"Current Scene {AdvDia.CurrentWorldScene.Name} ({AdvDia.CurrentWorldScene.SnoId})");
            Core.Logger.Debug($"Closest gate Scene {gateScene.WorldScene.Name} ({gateScene.WorldScene.SnoId}), Sequence={sequence.Index + 1}/{sequence.Count}");
            return(sequence);
        }
Beispiel #29
0
        /// <summary>
        /// EVE Agents
        /// </summary>
        /// <returns><c>Bag</c> of EVE Agents</returns>
        internal static Bag<AgtAgents> Agents()
        {
            var list = new IndexedList<AgtAgents>();

            foreach (agtAgents agent in Context.agtAgents)
            {
                var item = new AgtAgents
                               {
                                   ID = agent.agentID,
                                   LocationID = agent.locationID.Value,
                                   Level = agent.level.Value
                               };

                if (agent.quality.HasValue)
                    item.Quality = agent.quality.Value;

                list.Items.Add(item);
            }

            return new Bag<AgtAgents>(list);
        }
        public ScenecontrolData()
        {
            xAxisKeys = new IndexedList <ControlAxisKey>();
            yAxisKeys = new IndexedList <ControlAxisKey>();
            zAxisKeys = new IndexedList <ControlAxisKey>();

            xRotAxisKeys = new IndexedList <ControlAxisKey>();
            yRotAxisKeys = new IndexedList <ControlAxisKey>();
            zRotAxisKeys = new IndexedList <ControlAxisKey>();

            xScaleAxisKeys = new IndexedList <ControlAxisKey>();
            yScaleAxisKeys = new IndexedList <ControlAxisKey>();
            zScaleAxisKeys = new IndexedList <ControlAxisKey>();

            redKeys   = new IndexedList <ControlAxisKey>();
            greenKeys = new IndexedList <ControlAxisKey>();
            blueKeys  = new IndexedList <ControlAxisKey>();
            alphaKeys = new IndexedList <ControlAxisKey>();

            enableKeys = new IndexedList <ControlValueKey <bool> >();
        }
Beispiel #31
0
        public static VarianceResult DetailedCompare <T>(this T val1, T val2)
        {
            if (val1 == null || val2 == null)
            {
                return(new VarianceResult());
            }

            var type      = val1.GetType();
            var variances = new IndexedList <Variance>();

            foreach (var f in type.GetFields())
            {
                CompareValue(f.GetValue(val1), f.GetValue(val2), f.Name, variances);
            }

            foreach (var f in type.GetProperties())
            {
                CompareValue(f.GetValue(val1), f.GetValue(val2), f.Name, variances);
            }

            return(new VarianceResult(variances));
        }
Beispiel #32
0
        public static void CompareValue <T>(T val1, T val2, string propName, IndexedList <Variance> newVariances)
        {
            var v = new Variance
            {
                Name = propName,
                valA = val1,
                valB = val2
            };

            if (v.valA == null && v.valB == null)
            {
                return;
            }

            if (v.valA == null || v.valB == null)
            {
                newVariances.Add(v);
            }
            else if (!v.valA.Equals(v.valB))
            {
                newVariances.Add(v);
            }
        }
Beispiel #33
0
        public void TestRecentlyCompleted()
        {
            #region Arrange

            new FakeOrderHistory(10, QueryRepositoryFactory.OrderHistoryRepository);
            var rtValue1 = new IndexedList <OrderHistory>();
            rtValue1.LastModified = DateTime.UtcNow.ToPacificTime().Date.AddHours(7);
            rtValue1.Results      = QueryRepositoryFactory.OrderHistoryRepository.Queryable.Take(5).ToList();

            var rtValue2 = new IndexedList <OrderHistory>();
            rtValue2.LastModified = DateTime.UtcNow.ToPacificTime().Date.AddHours(7);
            rtValue2.Results      = QueryRepositoryFactory.OrderHistoryRepository.Queryable.Take(3).ToList();

            OrderService.Expect(a => a.GetIndexedListofOrders(null, null, false, false, OrderStatusCode.Codes.Denied, null, null, true,
                                                              new DateTime(DateTime.UtcNow.ToPacificTime().Year, DateTime.UtcNow.ToPacificTime().Month, 1), null))
            .Return(rtValue1);
            OrderService.Expect(a => a.GetIndexedListofOrders(null, null, true, false, OrderStatusCode.Codes.Complete, null, null, true,
                                                              new DateTime(DateTime.UtcNow.ToPacificTime().Year, DateTime.UtcNow.ToPacificTime().Month, 1), null))
            .Return(rtValue2);
            #endregion Arrange

            #region Act
            var results = Controller.RecentlyCompleted()
                          .AssertResultIs <JsonNetResult>();
            #endregion Act


            #region Assert
            dynamic data = JObject.FromObject(results.Data);
            Assert.AreEqual(5, (int)data.deniedThisMonth);
            Assert.AreEqual(3, (int)data.completedThisMonth);
            OrderService.AssertWasCalled(a => a.GetIndexedListofOrders(null, null, false, false, OrderStatusCode.Codes.Denied, null, null, true,
                                                                       new DateTime(DateTime.UtcNow.ToPacificTime().Year, DateTime.UtcNow.ToPacificTime().Month, 1), null));
            OrderService.AssertWasCalled(a => a.GetIndexedListofOrders(null, null, true, false, OrderStatusCode.Codes.Complete, null, null, true,
                                                                       new DateTime(DateTime.UtcNow.ToPacificTime().Year, DateTime.UtcNow.ToPacificTime().Month, 1), null));
            #endregion Assert
        }
Beispiel #34
0
        public void CleanIndexes()
        {
            InterfaceMethodsIndexedByGenericSignature = new Dictionary <string, MethodDefinition>();
            InterfaceMethodsIndexedByName             = new Dictionary <string, MethodDefinition>();
            AbstractMethodsIndexedByName                   = new Dictionary <string, MethodDefinition>();
            ImplementationMethodsIndexedByName             = new Dictionary <string, MethodDefinition>();
            ImplementationMethodsIndexedByGenericSignature = new Dictionary <string, MethodDefinition>();

            ImplementationMethodsList = new List <MethodDefinition>();
            InterfaceMethodsList      = new List <MethodDefinition>();
            AbstractMethodsList       = new List <MethodDefinition>();

            InterfaceMethodsIndexedByTypeName      = new IndexedList <string, MethodDefinition>();
            AbstractMethodsIndexedByTypeName       = new IndexedList <string, MethodDefinition>();
            ImplementationMethodsIndexedByTypeName = new IndexedList <string, MethodDefinition>();

            MethodObjectsIndexedByFullName = new IndexedList <string, MethodObject>();

            InterfaceTypes      = new Dictionary <string, TypeDefinition>();
            AbstractTypes       = new Dictionary <string, TypeDefinition>();
            ImplementationTypes = new Dictionary <string, TypeDefinition>();

            MethodObjectsList = new List <MethodObject>();
        }
Beispiel #35
0
        /// <summary>
        /// EVE Icons
        /// </summary>
        /// <returns><c>Bag</c> of icons</returns>
        internal static Bag<EveIcons> Icons()
        {
            var list = new IndexedList<EveIcons>();

            foreach (eveIcons icon in Context.eveIcons)
            {
                var item = new EveIcons
                               {
                                   ID = icon.iconID,
                                   Icon = icon.iconFile
                               };

                list.Items.Add(item);
            }

            return new Bag<EveIcons>(list);
        }
Beispiel #36
0
        /// <summary>
        /// Inventory Types
        /// </summary>
        /// <returns><c>Bag</c> of items from the Inventory</returns>
        internal static Bag<InvType> Types()
        {
            var list = new IndexedList<InvType>();

            foreach (invTypes type in Context.invTypes)
            {
                var item = new InvType
                               {
                                   ID = type.typeID,
                                   Description = type.description.Clean(),
                                   IconID = type.iconID,
                                   MarketGroupID = type.marketGroupID,
                                   Name = type.typeName,
                                   RaceID = type.raceID
                               };

                if (type.basePrice.HasValue)
                    item.BasePrice = type.basePrice.Value;

                if (type.capacity.HasValue)
                    item.Capacity = type.capacity.Value;

                if (type.groupID.HasValue)
                    item.GroupID = type.groupID.Value;

                if (type.mass.HasValue)
                    item.Mass = type.mass.Value;

                if (type.published.HasValue)
                    item.Published = type.published.Value;

                if (type.volume.HasValue)
                    item.Volume = type.volume.Value;

                list.Items.Add(item);
            }

            return new Bag<InvType>(list);
        }
Beispiel #37
0
		///
		private void SetObjectData(SerializationInfo info, StreamingContext context)
		{
			_maxRunned = info.GetByte("_maxRunned");
			_checkRunTimeInterval = info.GetByte("_checkRunTimeInterval");
			_useExternalPulse = info.GetBoolean("_useExternalPulse");
			SchedulerTask[] arr = (SchedulerTask[])info.GetValue("_tasks", typeof(SchedulerTask[]));
			if(_tasks == null)
				_tasks = new IndexedList<SchedulerTask, OID>("OID");
			_tasks.Add(arr);
			if(_useExternalPulse == false)
				_timer = new Timer(Pulse, null, Timeout.Infinite, Timeout.Infinite);
		}
Beispiel #38
0
 protected LLUseSpellTag()
 {
     Hotspots = new IndexedList <HotSpot>();
 }
        public void TestAddNullKey()
        {
            IndexedList<string, SiteLink> list = new IndexedList<string, SiteLink>(siteLink => siteLink.SiteId) {
                new SiteLink("enwiki", "Foo")
            };

            Assert.Throws<ArgumentNullException>(() => list.Add(new SiteLink()));
        }
Beispiel #40
0
        /// <summary>
        /// EVE Attributes
        /// </summary>
        /// <returns><c>Bag</c> of Attributes</returns>
        internal static Bag<DgmAttributeTypes> Attributes()
        {
            var list = new IndexedList<DgmAttributeTypes>();

            foreach (dgmAttributeTypes attribute in Context.dgmAttributeTypes)
            {
                var item = new DgmAttributeTypes
                               {
                                   ID = attribute.attributeID,
                                   CategoryID = attribute.categoryID,
                                   Description = attribute.description.Clean(),
                                   DisplayName = attribute.displayName.Clean(),
                                   IconID = attribute.iconID,
                                   Name = attribute.attributeName.Clean(),
                                   UnitID = attribute.unitID
                               };

                if (attribute.defaultValue.HasValue)
                    item.DefaultValue = attribute.defaultValue.Value.ToString();

                if (attribute.highIsGood.HasValue)
                    item.HigherIsBetter = attribute.highIsGood.Value;

                list.Items.Add(item);
            }

            return new Bag<DgmAttributeTypes>(list);
        }
        public void TestForeach()
        {
            IndexedList<string, SiteLink> list = new IndexedList<string, SiteLink> (siteLink => siteLink.SiteId) {
                new SiteLink("enwiki", "Foo")
            };

            foreach (SiteLink siteLink in list)
            {
                Assert.Equal("enwiki", siteLink.SiteId);
                Assert.Equal("Foo", siteLink.PageName);
            }
        }
Beispiel #42
0
        /// <summary>
        /// Solar Systems in EVE
        /// </summary>
        /// <returns><c>Bag</c> of Solar Systems in the EVE</returns>
        internal static Bag<MapSolarSystem> Solarsystems()
        {
            var list = new IndexedList<MapSolarSystem>();

            foreach (mapSolarSystems solarsystem in Context.mapSolarSystems)
            {
                var item = new MapSolarSystem
                               {
                                   ID = solarsystem.solarSystemID,
                                   Name = solarsystem.solarSystemName
                               };

                if (solarsystem.constellationID.HasValue)
                    item.ConstellationID = solarsystem.constellationID.Value;

                if (solarsystem.security.HasValue)
                    item.SecurityLevel = (float) solarsystem.security.Value;

                if (solarsystem.x.HasValue)
                    item.X = solarsystem.x.Value;

                if (solarsystem.y.HasValue)
                    item.Y = solarsystem.y.Value;

                if (solarsystem.z.HasValue)
                    item.Z = solarsystem.z.Value;

                list.Items.Add(item);
            }

            return new Bag<MapSolarSystem>(list);
        }
        public void TestContainsKey()
        {
            IndexedList<string, SiteLink> list = new IndexedList<string, SiteLink>(siteLink => siteLink.SiteId) {
                new SiteLink("enwiki", "Foo")
            };

            Assert.True(list.ContainsKey("enwiki"));
            Assert.False(list.ContainsKey("xxwiki"));
        }
Beispiel #44
0
 protected SoHuntBehavior()
 {
     Hotspots = new IndexedList <HotSpot>();
 }
        public void TestIndexWhenOrderStatusFilterIsApprover()
        {
            #region Arrange
            Controller.ControllerContext.HttpContext = new MockHttpContext(0, new[] { "" }, "Me");
            new FakeOrderHistory(3, OrderHistoryRepository);
            var prefs = new List<ColumnPreferences>();
            prefs.Add(CreateValidEntities.ColumnPreferences(1));
            prefs[0].SetIdTo("Me");
            prefs[0].DisplayRows = 25;
            new FakeColumnPreferences(0, ColumnPreferencesRepository, prefs, true);
            var rtValue = new IndexedList<OrderHistory>();
            rtValue.LastModified = DateTime.UtcNow.ToPacificTime().Date.AddHours(7);
            rtValue.Results = OrderHistoryRepository.Queryable.ToList();
            OrderService.Expect(
                a =>
                a.GetIndexedListofOrders(Arg<string>.Is.Anything,Arg<string>.Is.Anything, Arg<bool>.Is.Anything, Arg<bool>.Is.Anything, Arg<string>.Is.Anything,
                                  Arg<DateTime?>.Is.Anything, Arg<DateTime?>.Is.Anything, Arg<bool>.Is.Anything,
                                  Arg<DateTime?>.Is.Anything, Arg<DateTime?>.Is.Anything)).Return(
                                      rtValue);
            #endregion Arrange

            #region Act
            var result = Controller.Index(OrderStatusCode.Codes.Approver, null, null, null, null, false, false)
                .AssertViewRendered()
                .WithViewData<FilteredOrderListModelDto>();
            #endregion Act

            #region Assert

            #region GetListOfOrder Args
            OrderService.AssertWasCalled(a => a.GetIndexedListofOrders(Arg<string>.Is.Anything,Arg<string>.Is.Anything, Arg<bool>.Is.Anything, Arg<bool>.Is.Anything,
                                                           Arg<string>.Is.Anything,
                                                           Arg<DateTime?>.Is.Anything, Arg<DateTime?>.Is.Anything,
                                                           Arg<bool>.Is.Anything,
                                                           Arg<DateTime?>.Is.Anything, Arg<DateTime?>.Is.Anything));
            var args = OrderService.GetArgumentsForCallsMadeOn(
                    a => a.GetIndexedListofOrders(Arg<string>.Is.Anything,Arg<string>.Is.Anything, Arg<bool>.Is.Anything, Arg<bool>.Is.Anything,
                                           Arg<string>.Is.Anything,
                                           Arg<DateTime?>.Is.Anything, Arg<DateTime?>.Is.Anything,
                                           Arg<bool>.Is.Anything,
                                           Arg<DateTime?>.Is.Anything, Arg<DateTime?>.Is.Anything))[0];
            Assert.IsNotNull(args);
            Assert.IsNull(args[0]);
            Assert.IsNull(args[1]);
            Assert.AreEqual(false, args[2]);
            Assert.AreEqual(false, args[3]);
            Assert.AreEqual(OrderStatusCode.Codes.Approver, args[4]);
            Assert.AreEqual(null, args[5]);
            Assert.AreEqual(null, args[6]);
            Assert.AreEqual(false, args[7]);
            Assert.AreEqual(null, args[8]);
            Assert.AreEqual(null, args[9]);
            #endregion GetListOfOrder Args

            Assert.IsNotNull(result);
            Assert.AreEqual(OrderStatusCode.Codes.Approver, result.SelectedOrderStatus);
            Assert.AreEqual(null, result.StartDate);
            Assert.AreEqual(null, result.EndDate);
            Assert.AreEqual(null, result.StartLastActionDate);
            Assert.AreEqual(null, result.EndLastActionDate);
            Assert.AreEqual(false, result.ShowPending);
            Assert.AreEqual(false, result.ShowCreated);
            Assert.AreEqual("Me", result.ColumnPreferences.Id); // Did exist
            Assert.AreEqual(25, Controller.ViewBag.DataTablesPageSize);
            Assert.AreEqual(3, result.OrderHistory.Count);
            #endregion Assert
        }
Beispiel #46
0
        /// <summary>
        /// EVE Units
        /// </summary>
        /// <returns><c>Bag</c> of EVE Units</returns>
        internal static Bag<EveUnit> Units()
        {
            var list = new IndexedList<EveUnit>();

            foreach (eveUnits unit in Context.eveUnits)
            {
                var item = new EveUnit
                               {
                                   Description = unit.description.Clean(),
                                   DisplayName = unit.displayName.Clean(),
                                   ID = unit.unitID,
                                   Name = unit.unitName
                               };

                list.Items.Add(item);
            }

            return new Bag<EveUnit>(list);
        }
Beispiel #47
0
        /// <summary>
        /// EVE Names
        /// </summary>
        /// <returns><c>Bag</c> of EVE Names</returns>
        internal static Bag<EveNames> Names()
        {
            var list = new IndexedList<EveNames>();

            foreach (eveNames name in Context.eveNames)
            {
                var item = new EveNames
                               {
                                   ID = name.itemID,
                                   Name = name.itemName
                               };

                list.Items.Add(item);
            }

            return new Bag<EveNames>(list);
        }
Beispiel #48
0
        /// <summary>
        /// Regions in the EVE Universe
        /// </summary>
        /// <returns><c>Bag</c> of all regions in EVE</returns>
        internal static Bag<MapRegion> Regions()
        {
            var list = new IndexedList<MapRegion>();

            foreach (mapRegions region in Context.mapRegions)
            {
                var item = new MapRegion
                               {
                                   ID = region.regionID,
                                   Name = region.regionName,
                                   FactionID = region.factionID
                               };

                list.Items.Add(item);
            }

            return new Bag<MapRegion>(list);
        }
Beispiel #49
0
        /// <summary>
        /// Inventory Item Groups
        /// </summary>
        /// <returns><c>Bag</c> of Inventory Groups</returns>
        internal static Bag<InvGroup> Groups()
        {
            var list = new IndexedList<InvGroup>();

            foreach (invGroups group in Context.invGroups)
            {
                var item = new InvGroup
                               {
                                   ID = group.groupID,
                                   Name = group.groupName,
                                   Published = group.published.Value
                               };

                if (group.categoryID.HasValue)
                    item.CategoryID = group.categoryID.Value;

                list.Items.Add(item);
            }

            return new Bag<InvGroup>(list);
        }
 public void TestCount()
 {
     IndexedList<string, SiteLink> list = new IndexedList<string, SiteLink> (siteLink => siteLink.SiteId) {
         new SiteLink("enwiki", "Foo"),
         new SiteLink("dewiki", "Bar")
     };
     Assert.Equal(2, list.Count);
 }
Beispiel #51
0
        public IndexedList<Vector3> MoveToPathToLocation(Vector3 Destination)
        {
            if (CurrentPathFinderPath.Count==0)
                     {
                          if (NP.CurrentPath.Count>0)
                                CachedPathFinderCurrentPath=new IndexedList<Vector3>(NP.CurrentPath.ToArray());

                          NP.Clear();
                          NP.MoveTo(Destination, "Pathing");
                          CurrentPathFinderPath=new IndexedList<Vector3>(NP.CurrentPath.ToArray());
                     }

                     return CurrentPathFinderPath;
        }
        public void TestAdminOrdersWhenOrderStatusFilterIsAll2()
        {
            #region Arrange
            Controller.ControllerContext.HttpContext = new MockHttpContext(0, new[] { "" }, "Me");
            new FakeOrderHistory(3, OrderHistoryRepository);
            new FakeColumnPreferences(3, ColumnPreferencesRepository);
            var rtValue = new IndexedList<OrderHistory>();
            rtValue.LastModified = DateTime.UtcNow.ToPacificTime().Date.AddHours(7);
            rtValue.Results = OrderHistoryRepository.Queryable.ToList();

            OrderService.Expect(
                a =>
                a.GetAdministrativeIndexedListofOrders(Arg<string>.Is.Anything,Arg<string>.Is.Anything, Arg<bool>.Is.Anything, Arg<bool>.Is.Anything, Arg<string>.Is.Anything,
                                  Arg<DateTime?>.Is.Anything, Arg<DateTime?>.Is.Anything,
                                  Arg<DateTime?>.Is.Anything, Arg<DateTime?>.Is.Anything)).Return(
                                      rtValue);
            #endregion Arrange

            #region Act
            var result = Controller.AdminOrders("All", DateTime.UtcNow.ToPacificTime().Date.AddDays(1), DateTime.UtcNow.ToPacificTime().Date.AddDays(2), DateTime.UtcNow.ToPacificTime().Date.AddDays(3), DateTime.UtcNow.ToPacificTime().Date.AddDays(4), true)
                .AssertViewRendered()
                .WithViewData<FilteredOrderListModelDto>();
            #endregion Act

            #region Assert

            #region GetListOfOrder Args
            OrderService.AssertWasCalled(a =>
                a.GetAdministrativeIndexedListofOrders(Arg<string>.Is.Anything,Arg<string>.Is.Anything, Arg<bool>.Is.Anything, Arg<bool>.Is.Anything, Arg<string>.Is.Anything,
                                  Arg<DateTime?>.Is.Anything, Arg<DateTime?>.Is.Anything,
                                  Arg<DateTime?>.Is.Anything, Arg<DateTime?>.Is.Anything));
            var args = OrderService.GetArgumentsForCallsMadeOn(a =>
                a.GetAdministrativeIndexedListofOrders(Arg<string>.Is.Anything,Arg<string>.Is.Anything, Arg<bool>.Is.Anything, Arg<bool>.Is.Anything, Arg<string>.Is.Anything,
                                  Arg<DateTime?>.Is.Anything, Arg<DateTime?>.Is.Anything,
                                  Arg<DateTime?>.Is.Anything, Arg<DateTime?>.Is.Anything))[0];
            Assert.IsNotNull(args);
            Assert.IsNull(args[0]);
            Assert.IsNull(args[1]);
            Assert.AreEqual(false, args[2]);
            Assert.AreEqual(true, args[3]);
            Assert.AreEqual(null, args[4]); // because we chose all
            Assert.AreEqual(DateTime.UtcNow.ToPacificTime().Date.AddDays(1), args[5]);
            Assert.AreEqual(DateTime.UtcNow.ToPacificTime().Date.AddDays(2), args[6]);
            Assert.AreEqual(DateTime.UtcNow.ToPacificTime().Date.AddDays(3), args[7]);
            Assert.AreEqual(DateTime.UtcNow.ToPacificTime().Date.AddDays(4), args[8]);
            #endregion GetListOfOrder Args

            Assert.IsNotNull(result);
            Assert.AreEqual(null, result.SelectedOrderStatus);
            Assert.AreEqual(DateTime.UtcNow.ToPacificTime().Date.AddDays(1), result.StartDate);
            Assert.AreEqual(DateTime.UtcNow.ToPacificTime().Date.AddDays(2), result.EndDate);
            Assert.AreEqual(DateTime.UtcNow.ToPacificTime().Date.AddDays(3), result.StartLastActionDate);
            Assert.AreEqual(DateTime.UtcNow.ToPacificTime().Date.AddDays(4), result.EndLastActionDate);
            Assert.AreEqual(true, result.ShowPending);
            Assert.AreEqual("Me", result.ColumnPreferences.Id); // Did not exist, so created with defaults
            Assert.AreEqual(50, Controller.ViewBag.DataTablesPageSize);
            #endregion Assert
        }
Beispiel #53
0
 protected SoGrindTag()
 {
     Hotspots = new IndexedList <HotSpot>();
 }
        public void TestAdminOrdersWhenOrderStatusFilterIsPaid2()
        {
            #region Arrange
            Controller.ControllerContext.HttpContext = new MockHttpContext(0, new[] { "" }, "Me");
            var orderHistories = new List<OrderHistory>();
            for (int i = 0; i < 3; i++)
            {
                orderHistories.Add(CreateValidEntities.OrderHistory(i + 1));
                orderHistories[i].Received = "Yes";
            }
            orderHistories[1].Received = "No";
            new FakeOrderHistory(0, OrderHistoryRepository, orderHistories);
            var prefs = new List<ColumnPreferences>();
            prefs.Add(CreateValidEntities.ColumnPreferences(1));
            prefs[0].SetIdTo("Me");
            prefs[0].DisplayRows = 25;
            new FakeColumnPreferences(0, ColumnPreferencesRepository, prefs, true);
            var rtValue = new IndexedList<OrderHistory>();
            rtValue.LastModified = DateTime.UtcNow.ToPacificTime().Date.AddHours(7);
            rtValue.Results = OrderHistoryRepository.Queryable.ToList();
            OrderService.Expect(a =>
                a.GetAdministrativeIndexedListofOrders(Arg<string>.Is.Anything, Arg<string>.Is.Anything, Arg<bool>.Is.Anything, Arg<bool>.Is.Anything, Arg<string>.Is.Anything,
                                  Arg<DateTime?>.Is.Anything, Arg<DateTime?>.Is.Anything,
                                  Arg<DateTime?>.Is.Anything, Arg<DateTime?>.Is.Anything)).Return(
                                      rtValue);
            #endregion Arrange

            #region Act
            var result = Controller.AdminOrders("Paid", null, null, null, null, false)
                .AssertViewRendered()
                .WithViewData<FilteredOrderListModelDto>();
            #endregion Act

            #region Assert

            #region GetListOfOrder Args
            OrderService.AssertWasCalled(a =>
                a.GetAdministrativeIndexedListofOrders(Arg<string>.Is.Anything, Arg<string>.Is.Anything, Arg<bool>.Is.Anything, Arg<bool>.Is.Anything, Arg<string>.Is.Anything,
                                  Arg<DateTime?>.Is.Anything, Arg<DateTime?>.Is.Anything,
                                  Arg<DateTime?>.Is.Anything, Arg<DateTime?>.Is.Anything));
            var args = OrderService.GetArgumentsForCallsMadeOn(a =>
                a.GetAdministrativeIndexedListofOrders(Arg<string>.Is.Anything, Arg<string>.Is.Anything, Arg<bool>.Is.Anything, Arg<bool>.Is.Anything, Arg<string>.Is.Anything,
                                  Arg<DateTime?>.Is.Anything, Arg<DateTime?>.Is.Anything,
                                  Arg<DateTime?>.Is.Anything, Arg<DateTime?>.Is.Anything))[0];
            Assert.IsNotNull(args);
            Assert.AreEqual(null, args[0]);
            Assert.AreEqual("yes", args[1]);
            Assert.AreEqual(true, args[2]);
            Assert.AreEqual(false, args[3]);
            Assert.AreEqual(OrderStatusCode.Codes.Complete, args[4]); // because we chose Receive/unReceive
            Assert.AreEqual(null, args[5]);
            Assert.AreEqual(null, args[6]);
            Assert.AreEqual(null, args[7]);
            Assert.AreEqual(null, args[8]);
            #endregion GetListOfOrder Args

            Assert.IsNotNull(result);
            Assert.AreEqual(OrderStatusCode.Codes.Complete, result.SelectedOrderStatus);
            Assert.AreEqual(null, result.StartDate);
            Assert.AreEqual(null, result.EndDate);
            Assert.AreEqual(null, result.StartLastActionDate);
            Assert.AreEqual(null, result.EndLastActionDate);
            Assert.AreEqual(false, result.ShowPending);
            Assert.AreEqual("Me", result.ColumnPreferences.Id); // Did exist
            Assert.AreEqual(25, Controller.ViewBag.DataTablesPageSize);
            #endregion Assert
        }
 public void TestCountEmpty()
 {
     IndexedList<string, SiteLink> list = new IndexedList<string, SiteLink>(siteLink => siteLink.SiteId);
     Assert.Equal(0, list.Count);
 }
Beispiel #56
0
 private ExampleRepo(IndexedList<int, MyEntity> myEntities)
 {
     _myEntities = myEntities ?? _defaultMyEntities;
 }
Beispiel #57
0
        /// <summary>
        /// Inventory Item Market Groups
        /// </summary>
        /// <returns><c>Bag</c> of Market Groups available on the market</returns>
        internal static Bag<InvMarketGroup> MarketGroups()
        {
            var list = new IndexedList<InvMarketGroup>();

            foreach (invMarketGroups marketGroup in Context.invMarketGroups)
            {
                var item = new InvMarketGroup
                               {
                                   ID = marketGroup.marketGroupID,
                                   Description = marketGroup.description.Clean(),
                                   IconID = marketGroup.iconID,
                                   Name = marketGroup.marketGroupName,
                                   ParentID = marketGroup.parentGroupID
                               };

                list.Items.Add(item);
            }

            return new Bag<InvMarketGroup>(list);
        }
Beispiel #58
0
        /// <summary>
        /// Stations in the EVE Universe
        /// </summary>
        /// <returns><c>Bag</c> of Stations in the EVE Universe</returns>
        internal static Bag<StaStation> Stations()
        {
            var list = new IndexedList<StaStation>();

            foreach (staStations station in Context.staStations)
            {
                var item = new StaStation
                               {
                                   ID = station.stationID,
                                   Name = station.stationName,
                               };

                if (station.reprocessingEfficiency.HasValue)
                    item.ReprocessingEfficiency = (float) station.reprocessingEfficiency.Value;

                if (station.reprocessingStationsTake.HasValue)
                    item.ReprocessingStationsTake = (float) station.reprocessingStationsTake.Value;

                if (station.security.HasValue)
                    item.SecurityLevel = station.security.Value;

                if (station.solarSystemID.HasValue)
                    item.SolarSystemID = station.solarSystemID.Value;

                if (station.corporationID.HasValue)
                    item.CorporationID = station.corporationID.Value;

                list.Items.Add(item);
            }

            return new Bag<StaStation>(list);
        }
Beispiel #59
0
 protected SoFate()
 {
     hotSpots = new IndexedList <HotSpot>();
 }
        public void TestRemoveNotExisting()
        {
            IndexedList<string, SiteLink> list = new IndexedList<string, SiteLink>(siteLink => siteLink.SiteId) {
                new SiteLink("enwiki", "Foo")
            };

            Assert.False(list.Remove("xxwiki"));
        }