Exemplo n.º 1
0
        static void Main(String[] args)
        {
            CList <CTest> l = new CList <CTest>();

            l.Add(new CTest());
            l.Add(new CTest());
            l.Add(new CTest());
            l.Remove(2);
            l.Remove(1);

            var i = l.Add(new CTest());
            var v = i.Index;



            l.AddAt(1, new CTest());
            l.AddAt(2, new CTest());
            l.AddAt(0, new CTest());
            l.Remove(1);
            var i0 = l.Get(0);


            var i1 = l.Get(1);

            if (i1)
            {
                Console.WriteLine("i1");
            }

            var i2 = l.Get(2);
            var i3 = l.Get(3);

            Console.WriteLine("end");
        }
Exemplo n.º 2
0
            void _LinkFail(TPeerCnt PeerNum_, ENetRet NetRet_)
            {
                var itServer = _Servers.Get((Int32)PeerNum_);

                itServer.Data.NamePort.Clear();

                _Servers.Remove(itServer);
                _LinkFailFunc(PeerNum_, NetRet_);
            }
        public void AddAndRemoveNonReferencingElementsFromCList()
        {
            var storage = new InMemoryStorageEngine();
            var os      = ObjectStore2.New(storage);

            var cList = new CList <string>();

            cList.Add("hello");
            cList.Add("world");
            cList.Add("from here");

            os.Roots.Entangle(cList);
            os.Persist();

            os    = ObjectStore2.Load(storage);
            cList = os.Roots.Find <CList <string> >();
            cList.Count.ShouldBe(3);
            cList[0].ShouldBe("hello");
            cList[1].ShouldBe("world");
            cList[2].ShouldBe("from here");

            cList.Remove(0);

            os.Persist();

            os    = ObjectStore2.Load(storage);
            cList = os.Roots.Find <CList <string> >();
            cList.Count.ShouldBe(2);
            cList[0].ShouldBe("world");
            cList[1].ShouldBe("from here");
            cList.Remove(1);

            os.Persist();

            os    = ObjectStore2.Load(storage);
            cList = os.Roots.Find <CList <string> >();
            cList.Count.ShouldBe(1);
            cList[0].ShouldBe("world");
            cList.Add("hello");

            os.Persist();

            os    = ObjectStore2.Load(storage);
            cList = os.Roots.Find <CList <string> >();
            cList.Count.ShouldBe(2);
            cList[0].ShouldBe("world");
            cList[1].ShouldBe("hello");

            cList.Remove(0);
            cList.Remove(0);

            os.Persist();

            os    = ObjectStore2.Load(storage);
            cList = os.Roots.Find <CList <string> >();
            cList.Count.ShouldBe(0);
        }
        public void ElementsAddedAndRemovedToListAreAddedToStateMap()
        {
            var l = new CList <int> {
                0, 1
            };

            AttachAndPersist(l);

            l.Remove(0);
            l.Remove(0);

            Persist();

            l = Load();
            l.Count.ShouldBe(0);
        }
Exemplo n.º 5
0
        //

        public void RemoveValue_Return_Expected_Count_8()
        {
            int count          = 8;
            int ExpectedResult = count;
            //Arrange
            CList <int> customList = new CList <int>();
            int         value1     = 10;
            int         value2     = 20;
            int         value3     = 30;
            int         value4     = 40;
            int         value5     = 50;
            int         value6     = 60;
            int         value7     = 70;
            int         value8     = 80;
            int         value9     = 90;


            //Act
            customList.Add(value1);
            customList.Add(value2);
            customList.Add(value3);
            customList.Add(value4);
            customList.Add(value5);
            customList.Add(value6);
            customList.Add(value7);
            customList.Add(value8);
            customList.Add(value9);

            customList.Remove(value2);


            //Assert
            Assert.AreEqual(ExpectedResult, customList.Count);
        }
Exemplo n.º 6
0
            public new void Close(TPeerCnt PeerNum_)
            {
                var Peer = _Peers.Get((Int32)PeerNum_);

                if (Peer)
                {
                    base.Close(PeerNum_);
                }
                else
                {
                    if (_PeersAndConnectings.Remove((Int32)PeerNum_)) // 여기서 지워야 LockFree 큐에서 들어오는 Connect 정보가 처리되지 않음.
                    {
                        _Connectings.Remove((Int32)PeerNum_);
                        _LinkFail(PeerNum_, ENetRet.UserClose);
                    }
                }
            }
Exemplo n.º 7
0
            bool _Connect(CList <_SServer> .SIterator Server_)
            {
                var ConnectNamePort = Server_.Data.PopConnectNamePort();

                if (ConnectNamePort)
                {
                    if (_NetS.Connect(ConnectNamePort, (TPeerCnt)Server_.Index))
                    {
                        return(true);
                    }
                }

                var PeerNum = (TPeerCnt)Server_.Index;

                _Servers.Remove(Server_);

                _LinkFailFuncS(PeerNum, ENetRet.ConnectFail);

                return(false);
            }
        public void InsertAndRemoveBeforePersist()
        {
            var l = new CList <int> {
                1
            };

            l.Remove(0);

            AttachAndPersist(l);

            Load().Count.ShouldBe(0);
        }
Exemplo n.º 9
0
        public void RemoveString_NegativeRemoval_NextString()
        {
            //Arrange
            CList <string> list = new CList <string> {
            };
            string new1String   = "New Addition 1";
            string new2String   = "New Addition 2";

            list.Add(new1String);
            list.Add(new2String);
            //Act
            list.Remove(new1String);
            //Assert
            Assert.AreNotEqual(list[0], new1String);
        }
Exemplo n.º 10
0
        public void RemoveInt_NegativeRemoval_NextInt()
        {
            //Arrange
            CList <int> list = new CList <int> {
            };
            int new1Int      = 1;
            int new2Int      = 2;

            list.Add(new1Int);
            list.Add(new2Int);
            //Act
            list.Remove(new1Int);
            //Assert
            Assert.AreNotEqual(list[0], new1Int);
        }
Exemplo n.º 11
0
        public void Remove_IndexOF_Add_Methode()
        {
            //Arrange
            CList <int> customList = new CList <int>();
            int         value      = 10;
            int         value1     = 20;

            //Act
            customList.Add(value);
            customList.Add(value1);
            customList.Remove(value1);


            //Assert
            Assert.AreEqual(value, customList[0]);
        }
Exemplo n.º 12
0
        public void RemoveFalseStringFrom2_PositiveRemoval_SameString()
        {
            //Arrange
            CList <string> list = new CList <string> {
            };
            string new1String   = "New Addition 1";
            string new2String   = "New Addition 2";
            string new3String   = "New Addition 3";

            list.Add(new1String);
            list.Add(new2String);
            //Act
            list.Remove(new3String);
            //Assert
            Assert.AreEqual(list[1], new2String);
        }
Exemplo n.º 13
0
        public void RemoveFalseIntFrom2_PositiveRemoval_SameInt()
        {
            //Arrange
            CList <int> list = new CList <int> {
            };
            int new1Int      = 1;
            int new2Int      = 2;
            int new3Int      = 3;

            list.Add(new1Int);
            list.Add(new2Int);
            //Act
            list.Remove(new3Int);
            //Assert
            Assert.AreEqual(list[1], new2Int);
        }
Exemplo n.º 14
0
            void _LoginClear(TPeerCnt PeerNum_, EGameRet GameRet_)
            {
                var itClient = _Clients.Get((Int32)PeerNum_);

                if (GameRet_ == EGameRet.InvalidID)
                {
                    itClient.Data.Clear();
                }

                _Clients.Remove(itClient);
            }
Exemplo n.º 15
0
        public void RemoveStringFrom3_PositiveRemoval_CorrectCount()
        {
            //Arrange
            CList <string> list = new CList <string> {
            };
            string new1String   = "New Addition 1";
            string new2String   = "New Addition 2";
            string new3String   = "New Addition 3";

            list.Add(new1String);
            list.Add(new2String);
            list.Add(new3String);
            //Act
            list.Remove(new2String);
            //Assert
            Assert.AreEqual(list.Count, 2);
        }
Exemplo n.º 16
0
        public void TestByCount_Add_Methode_Return_Expected_Count_1()
        {
            //Arrange
            CList <int> customList = new CList <int>();
            int         value      = 10;
            int         value2     = 20;
            int         CountValue = 1;

            //Act
            customList.Add(value);
            customList.Add(value2);
            customList.Remove(20);


            //Assert
            Assert.AreEqual(CountValue, customList.Count);
        }
Exemplo n.º 17
0
        public void Remove_Value_Returen_CountDecreise_ExpectedValue_1_()
        {
            //Arrange
            CList <int> customList     = new CList <int>();
            int         value          = 10;
            int         value2         = 20;
            int         Count          = 1;
            int         ExpectedResult = Count;

            //Act
            customList.Add(value);
            customList.Add(value2);
            customList.Remove(value2);


            //Assert
            Assert.AreEqual(ExpectedResult, customList.Count);
        }
Exemplo n.º 18
0
        public void Capacity_Check_Add_to_List_then_Remove_Index_3_ExpectedReturn_0()
        {
            //Arrange
            CList <int> customList = new CList <int>();
            int         value1     = 10;
            int         value2     = 20;

            int ExpectedResult = 0;

            //Act
            customList.Add(value1);
            customList.Add(value2);
            customList.Remove(value2);


            //Assert
            Assert.AreEqual(ExpectedResult, customList[3]);
        }
Exemplo n.º 19
0
        //

        public void RemoveValueIfArrayLenghtIs5_Returen_Expected_CapacityDicrease_Value_4()
        {
            //Arrange
            CList <int> customList     = new CList <int>(); // Need Inumerable{ 10, 20, 30, 40 };
            int         value          = 10;
            int         value2         = 20;
            int         Capacity       = 4;
            int         ExpectedResult = Capacity;

            //Act
            customList.Add(value);
            customList.Add(value2);
            customList.Add(value);
            customList.Add(value);
            customList.Remove(value2);


            //Assert
            Assert.AreEqual(ExpectedResult, customList.Capacity);
        }
Exemplo n.º 20
0
        public void RemoveValue_NextValue_expected_GetNewIndex_Value3()
        {
            //Arrange
            CList <int> customList     = new CList <int>();
            int         value1         = 10;
            int         value2         = 20;
            int         value3         = 30;
            int         ExpectedResult = value3;

            //Act
            customList.Add(value1);
            customList.Add(value2);
            customList.Add(value3);

            customList.Remove(value2);


            //Assert
            Assert.AreEqual(ExpectedResult, customList[1]);
        }
Exemplo n.º 21
0
        public void RemoveTestMethod()
        {
            //arrange
            CList <int> storedInts = new CList <int>();

            storedInts.Add(1);
            storedInts.Add(2);
            storedInts.Add(3);
            storedInts.Add(4);
            storedInts.Add(5);

            //act
            storedInts.Remove();

            //assert
            Assert.AreEqual(2, storedInts[0]);
            Assert.AreEqual(3, storedInts[1]);
            Assert.AreEqual(4, storedInts[2]);
            Assert.AreEqual(5, storedInts[3]);
            Assert.AreEqual(0, storedInts[4]);
            Assert.IsTrue(storedInts.count == 4);
        }
Exemplo n.º 22
0
 void _UnLinkCallback(CKey Key_, ENetRet NetRet_)
 {
     _PeersAndConnectings.Remove((Int32)Key_.PeerNum);
     _ConnectTimeOut.Remove((Int32)Key_.PeerNum);
     _UnLinkFunc(Key_, NetRet_);
 }
Exemplo n.º 23
0
 public void Remove(Int32 PeerNum_)
 {
     _Connects.Remove(PeerNum_);
 }