Inheritance: IMethods>
Exemplo n.º 1
0
        public void AllPassedFilterTest()
        {
            var check = new int[] { -1, 0, 5, 22, 44, 13451, 23, -43252, 555 };

            list = ListMethods.Filter(list, x => x > -50000);
            AssertAll(list, check);
        }
Exemplo n.º 2
0
        public void PositiveFilterTest()
        {
            var check = new int[] { 5, 22, 44, 13451, 23, 555 };

            list = ListMethods.Filter(list, x => x > 0);
            AssertAll(list, check);
        }
Exemplo n.º 3
0
        public void EvenFilterTest()
        {
            var check = new int[] { 0, 22, 44, -43252 };

            list = ListMethods.Filter(list, x => x % 2 == 0);
            AssertAll(list, check);
        }
Exemplo n.º 4
0
 public void TwoOperationsTest()
 {
     check = new int[] { -1, 0, 5, 13451, 23, -43252, 555 };
     list  = ListMethods.Map(list, x => x * 2);
     list  = ListMethods.Map(list, x => x / 2);
     AssertAll(list, check);
 }
Exemplo n.º 5
0
        public void NegativeFilterTest()
        {
            var check = new int[] { -1, -43252 };

            list = ListMethods.Filter(list, x => x < 0);
            AssertAll(list, check);
        }
Exemplo n.º 6
0
        public void TwoFilterTest()
        {
            var check = new int[] { 0, 22, 44 };

            list = ListMethods.Filter(list, x => x % 2 == 0);
            list = ListMethods.Filter(list, x => x >= 0);
            AssertAll(list, check);
        }
Exemplo n.º 7
0
 public void ThreeOperationsTest()
 {
     check = new int[] { 0, 0, 0, 0, 0, -0, 0 };
     list  = ListMethods.Map(list, x => x * 2);
     list  = ListMethods.Map(list, x => x / 2);
     list  = ListMethods.Map(list, x => x * 0);
     AssertAll(list, check);
 }
Exemplo n.º 8
0
        //Testines funkcijas galima rast ieskant #testarea
        //Tuscias funkcijas(nieko jose nebus daroma) galima rast ieskant #emptyarea

        public Form1()
        {
            InitializeComponent();
            ListMethods.StateCheck(this);
            InitializeProfileClick();
            // probably will need some method here to get current address of the current user
            ChildFormMethods.OpenChildFormMap(this);
            Application.ApplicationExit += new EventHandler(OnApplicationExit); //Method called on app exit
        }
Exemplo n.º 9
0
        private void ButtonSearch_Click(object sender, EventArgs e)
        {
            string keyword = FetchSearchKeyword();

            if (barsIsTop)
            {
                ListMethods.LoadBars(SearchMethods.SearchForBars(barManager.barDictionary, keyword), this);
            }
            else
            {
                ListMethods.LoadDrinks(SearchMethods.SearchForDrinks(drinkManager.drinkDictionary, keyword), this);
            }
        }
Exemplo n.º 10
0
        private void initListMethods()
        {
            Dictionary <string, Delegate> tmpDic = new Dictionary <string, Delegate>();

            Func <string> getNodeName = () => "users/user";

            tmpDic.Add("NodeName", getNodeName);
            tmpDic.Add("set", new Action <XmlNodeList>(AddUsersFromXmlNodeList));
            tmpDic.Add("get", new Func <XmlNodeList>(GetUsersAsXmlNodeList));
            tmpDic.Add("setFromList", new Action <List <User>, bool>(AddUsersFromList));
            tmpDic.Add("getAsList", new Func <List <User> >(GetUsersAsList));

            ListMethods.Add(tmpDic);
        }
Exemplo n.º 11
0
    public void TestGetLongestSubsequenceSequenceInMiddle()
    {
        List <int> numbers = new List <int>()
        {
            1, 1, 1, 2, 3, -6, -6, -6, -6, 9, 9
        };
        List <int> resultList = ListMethods.GetLongestSubsequence(numbers);

        List <int> expectedResult = new List <int>()
        {
            -6, -6, -6, -6
        };

        for (int i = 0; i < resultList.Count; i++)
        {
            Assert.AreEqual(resultList[i], expectedResult[i]);
        }
    }
Exemplo n.º 12
0
 public void MulitToNegativeTest()
 {
     check = new int[] { 1, 0, -5, -13451, -23, 43252, -555 };
     list  = ListMethods.Map(list, x => x *= -1);
     AssertAll(list, check);
 }
Exemplo n.º 13
0
 public void MultToZeroTest()
 {
     check = new int[] { 0, 0, 0, 0, 0, 0, 0 };
     list  = ListMethods.Map(list, x => x * 0);
     AssertAll(list, check);
 }
Exemplo n.º 14
0
 public void MultTo2Test()
 {
     check = new int[] { -2, 0, 10, 26902, 46, -86504, 1110 };
     list  = ListMethods.Map(list, x => x * 2);
     AssertAll(list, check);
 }
Exemplo n.º 15
0
 public void DivisionToZeroFoldTest()
 => ListMethods.Fold(list, (acc, element) => acc - element, 0);
Exemplo n.º 16
0
 public void MultipleOperationsFoldTest()
 {
     Assert.AreEqual(9692, ListMethods.Fold(list, (acc, element) => (acc - element) / 2, 0));
 }
 public ListMethodsUnitTest()
 {
     testSubject = new ListMethods();
 }
Exemplo n.º 18
0
 public void SumFroFiveTest()
 => Assert.AreEqual(-29214, ListMethods.Fold(list, (acc, element) => acc + element, 5));
Exemplo n.º 19
0
 public void MultToOneFoldTest()
 => Assert.AreEqual(0, ListMethods.Fold(list, (acc, element) => acc * element, 1));
Exemplo n.º 20
0
 public void MultToZeroFoldTest()
 => Assert.AreEqual(ListMethods.Fold(list, (acc, element) => acc * element, 0), 0);
Exemplo n.º 21
0
 public void TestGetLongestSubsequenceNull()
 {
     List <int> resultList = ListMethods.GetLongestSubsequence(null);
 }
Exemplo n.º 22
0
 public void TestGetLongestSubsequenceEmpty()
 {
     List <int> numbers    = new List <int>();
     List <int> resultList = ListMethods.GetLongestSubsequence(numbers);
 }
Exemplo n.º 23
0
 public void NonePassedFilterTest()
 {
     list = ListMethods.Filter(list, x => x == -50000);
     Assert.AreEqual(list.Count, 0);
 }
Exemplo n.º 24
0
 public void AdditionZeroTest()
 {
     check = new int[] { -1, 0, 5, 13451, 23, -43252, 555 };
     list  = ListMethods.Map(list, x => x + 0);
     AssertAll(list, check);
 }
Exemplo n.º 25
0
 public void SumSubstractionTest()
 => Assert.AreEqual(29219, ListMethods.Fold(list, (acc, element) => acc - element, 0));
Exemplo n.º 26
0
 public void SubtractionOneTest()
 {
     check = new int[] { -2, -1, 4, 13450, 22, -43253, 554 };
     list  = ListMethods.Map(list, x => x - 1);
     AssertAll(list, check);
 }
Exemplo n.º 27
0
 public void DivisionFoldTest()
 {
     list.Remove(0);
     Assert.AreEqual(0, ListMethods.Fold(list, (acc, element) => acc / element, 0));
 }
Exemplo n.º 28
0
 public void SumFoldTest()
 => Assert.AreEqual(-29219, ListMethods.Fold(list, (acc, element) => acc + element, 0));
Exemplo n.º 29
0
 private void ButtonBottom_Click(object sender, EventArgs e)
 {
     barsIsTop = !barsIsTop;
     ListMethods.StateCheck(this);
 }