Пример #1
0
        public void GetAllBySpecificationId_ShouldReturnEmptyArray_WhenWrongSpecificationId()
        {
            // Arrange
            var context = GetContext();
            var repo    = new SqlStandardConstructionRepo(context);

            // Act
            var standardConstructions = repo.GetAllBySpecificationId(999);

            // Assert
            Assert.Empty(standardConstructions);

            context.Database.EnsureDeleted();
            context.Dispose();
        }
Пример #2
0
        public void GetAllBySpecificationId_ShouldReturnstandardConstructions()
        {
            // Arrange
            var context = GetContext();
            var repo    = new SqlStandardConstructionRepo(context);

            var specificationId = _rnd.Next(1, _maxSpecificationId);

            // Act
            var standardConstructions = repo.GetAllBySpecificationId(specificationId);

            // Assert
            Assert.Equal(_standardConstructions.Where(
                             v => v.Specification.Id == specificationId), standardConstructions);

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