示例#1
0
        public void GetRangeOfBars_ListHolds2_Returns1()
        {
            // Arrange
            var fromIndex = 0;
            var length    = 1;
            var rangeBars = new List <Bar>();

            rangeBars.Add(defaultBar);
            mockUnitOfWork.BarRepository.GetXBars(fromIndex, length)
            .Returns(rangeBars);

            // Act
            var result       = uut.GetRangeOfBars(fromIndex, length);
            var objectResult = result as OkObjectResult;
            var listResult   = objectResult.Value as List <BarSimpleDto>;

            // Assert
            Assert.That(result, Is.TypeOf <OkObjectResult>());
            mockUnitOfWork.BarRepository.Received(1).GetXBars(fromIndex, length);
            Assert.That(listResult[0].BarName, Is.EqualTo(correctResultList[0].BarName));
            Assert.That(listResult.Count, Is.EqualTo(1));
        }