コード例 #1
0
        public int GetGoldenTarget(IMyList targetPoints)
        {
            if (targetPoints.Count < 2)
            {
                throw new ArgumentException("points.Count < 2", nameof(targetPoints));
            }

            return((targetPoints.GetFirst() + targetPoints.ElementAt(targetPoints.Count - 1)) / 2);
        }
コード例 #2
0
    public void ElementAt_NValuesAppended_ReturnsValueAtPositionK(int[] values, int index, int expectedValue)
    {
        IMyList list = CreateSUT();

        //Usually avoid adding loops
        foreach (var value in values)
        {
            list.Append(value);
        }

        Assert.Equal(expectedValue, list.ElementAt(index));
    }