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

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

            // Assert
            Assert.Empty(constructions);

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

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

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

            // Assert
            Assert.Equal(_constructions.Where(
                             v => v.Specification.Id == specificationId), constructions);

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