Пример #1
0
        public void UpdateTrendRanges_WorksProperly_IfItemsAreOnlyAdded()
        {
            //Arrange
            EFTrendlineRepository repository = new EFTrendlineRepository();

            TrendRangeDto[] trendRanges = getDefaultTrendRangeDtosArray();

            //Act
            clearTrendRangesTables();
            repository.UpdateTrendRanges(trendRanges);
            IEnumerable <TrendRangeDto> actualRecords = repository.GetTrendRanges(1);

            //Assert
            Assert.IsTrue(repository.GetTrendRanges(1).HasEqualItems(new TrendRangeDto[] { trendRanges[0], trendRanges[1], trendRanges[2] }));
            Assert.IsTrue(repository.GetTrendRanges(2).HasEqualItems(new TrendRangeDto[] { trendRanges[3] }));
        }
Пример #2
0
        public void UpdateTrendRanges_WorksProperly_IfItemsAreAddedAndUpdated()
        {
            //Arrange
            AnalysisDataQueryDefinition queryDef   = new AnalysisDataQueryDefinition(1, 1);
            EFTrendlineRepository       repository = new EFTrendlineRepository();

            TrendRangeDto[] trendRanges = getDefaultTrendRangeDtosArray();
            clearTrendRangesTables();
            repository.UpdateTrendRanges(new TrendRangeDto[] { trendRanges[0], trendRanges[1] });

            //Act
            trendRanges[0].NextBreakGuid = System.Guid.NewGuid().ToString();
            trendRanges[1].NextBreakGuid = System.Guid.NewGuid().ToString();
            repository.UpdateTrendRanges(trendRanges);

            //Assert
            Assert.IsTrue(repository.GetTrendRanges(1).HasEqualItems(new TrendRangeDto[] { trendRanges[0], trendRanges[1], trendRanges[2] }));
            Assert.IsTrue(repository.GetTrendRanges(2).HasEqualItems(new TrendRangeDto[] { trendRanges[3] }));
        }
Пример #3
0
        public void GetTrendRanges_returnProperDtoCollection()
        {
            //Arrange
            EFTrendlineRepository repository = new EFTrendlineRepository();

            TrendRangeDto[] ranges = getDefaultTrendRangeDtosArray();
            clearTrendRangesTables();
            repository.UpdateTrendRanges(ranges);

            //Act
            IEnumerable <TrendRangeDto> dtos = repository.GetTrendRanges(1).ToArray();

            //Assert
            IEnumerable <TrendRangeDto> expected = new TrendRangeDto[] { ranges[0], ranges[1], ranges[2] };
            bool areEqualArrays = expected.HasEqualItems(dtos);

            Assert.IsTrue(areEqualArrays);
        }