Exemplo n.º 1
0
        public void GetAllByConstructionId_ShouldReturnEmptyArray_WhenWrongConstructionId()
        {
            // Arrange
            var context = GetContext();
            var repo    = new SqlConstructionElementRepo(context);

            // Act
            var constructionElements = repo.GetAllByConstructionId(999);

            // Assert
            Assert.Empty(constructionElements);

            context.Database.EnsureDeleted();
            context.Dispose();
        }
Exemplo n.º 2
0
        public void GetAllByConstructionId_ShouldReturnConstructions()
        {
            // Arrange
            var context = GetContext();
            var repo    = new SqlConstructionElementRepo(context);

            var constructionId = _rnd.Next(1, _maxConstructionId);

            // Act
            var constructionElements = repo.GetAllByConstructionId(constructionId);

            // Assert
            Assert.Equal(_constructionElements.Where(
                             v => v.Construction.Id == constructionId), constructionElements);

            context.Database.EnsureDeleted();
            context.Dispose();
        }