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

            int specificationId      = _rnd.Next(1, _specifications.Count());
            var standardConstruction = new StandardConstruction
            {
                Specification = _specifications.SingleOrDefault(v => v.Id == specificationId),
                Name          = "NewCreate",
                Num           = 1,
                Sheet         = "NewCreate",
                Weight        = 1.0f,
            };

            // Act
            repo.Add(standardConstruction);

            // Assert
            Assert.NotNull(repo.GetById(standardConstruction.Id));

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