public void GetIndexNumberForLevelForTrough_IfThereAreBothQuotationsAndLevelLowerThanMasterLowPrice_ReturnsSlaveQuotationIndexNumber()
        {
            //Arrange
            DataSet   ds5        = utf.getDataSet(5);
            Price     price5     = utf.getPrice(ds5);
            Quotation quotation5 = new Quotation(ds5)
            {
                Id = 5, Open = 1.09127, High = 1.09235, Low = 1.09015, Close = 1.09067, Volume = 1519
            };
            Extremum master = new Extremum(price5, ExtremumType.TroughByClose);

            DataSet   ds6        = utf.getDataSet(6);
            Price     price6     = utf.getPrice(ds6);
            Quotation quotation6 = new Quotation(ds6)
            {
                Id = 6, Open = 1.09067, High = 1.09102, Low = 1.08947, Close = 1.09087, Volume = 1819
            };
            Extremum slave = new Extremum(price6, ExtremumType.TroughByLow);

            ExtremumGroup extremumGroup = new ExtremumGroup(master, slave);


            //Act
            int indexNumber = extremumGroup.GetIndexNumberForLevel(1.0900);


            //Assert
            int expectedIndex = 6;

            Assert.AreEqual(expectedIndex, indexNumber);
        }
        public void GetIndexNumberForLevelForTrough_ThrowsArgumentException_IfQuotationLevelAboveRange()
        {
            //Arrange
            DataSet   ds5        = utf.getDataSet(5);
            Price     price5     = utf.getPrice(ds5);
            Quotation quotation5 = new Quotation(ds5)
            {
                Id = 5, Open = 1.09127, High = 1.09235, Low = 1.09095, Close = 1.09157, Volume = 1519
            };
            Extremum      slave         = new Extremum(price5, ExtremumType.TroughByLow);
            ExtremumGroup extremumGroup = new ExtremumGroup(null, slave);

            //Act
            int indexNumber = extremumGroup.GetIndexNumberForLevel(1.0916);
        }
        public void GetIndexNumberForLevelForPeak_ThrowsArgumentException_IfQuotationLevelAboveRange()
        {
            //Arrange
            DataSet   ds5        = utf.getDataSet(5);
            Price     price5     = utf.getPrice(ds5);
            Quotation quotation5 = new Quotation(ds5)
            {
                Id = 5, Open = 1.09127, High = 1.09235, Low = 1.09095, Close = 1.09207, Volume = 1519
            };
            Extremum      master        = new Extremum(price5, ExtremumType.PeakByClose);
            ExtremumGroup extremumGroup = new ExtremumGroup(master, null);

            //Act
            int indexNumber = extremumGroup.GetIndexNumberForLevel(1.0941);
        }
        public void GetIndexNumberForLevelForTrough_IfThereIsOnlySlaveQuotation_ReturnsSlaveQuotationIndexNumber()
        {
            //Arrange
            DataSet   ds5        = utf.getDataSet(5);
            Price     price5     = utf.getPrice(ds5);
            Quotation quotation5 = new Quotation(ds5)
            {
                Id = 5, Open = 1.09127, High = 1.09235, Low = 1.09065, Close = 1.09107, Volume = 1519
            };
            Extremum      slave         = new Extremum(price5, ExtremumType.TroughByLow);
            ExtremumGroup extremumGroup = new ExtremumGroup(null, slave);

            //Act
            int indexNumber = extremumGroup.GetIndexNumberForLevel(1.09075);

            //Assert
            int expectedIndex = 5;

            Assert.AreEqual(expectedIndex, indexNumber);
        }
        public void GetIndexNumberForLevelForPeak_IfThereIsOnlyMasterQuotation_ReturnsMasterQuotationIndexNumber()
        {
            //Arrange
            DataSet   ds5        = utf.getDataSet(5);
            Price     price5     = utf.getPrice(ds5);
            Quotation quotation5 = new Quotation(ds5)
            {
                Id = 5, Open = 1.09127, High = 1.09235, Low = 1.09095, Close = 1.09207, Volume = 1519
            };
            Extremum      master        = new Extremum(price5, ExtremumType.PeakByClose);
            ExtremumGroup extremumGroup = new ExtremumGroup(master, null);

            //Act
            int indexNumber = extremumGroup.GetIndexNumberForLevel(1.09208);

            //Assert
            int expectedIndex = 5;

            Assert.AreEqual(expectedIndex, indexNumber);
        }