コード例 #1
0
ファイル: MarkRepoTest.cs プロジェクト: lulzzz/DocumentsKM
        public void Update_ShouldUpdateMark()
        {
            // Arrange
            var marks = new List <Mark> {
            };

            foreach (var m in TestData.marks)
            {
                marks.Add(new Mark
                {
                    Id                   = m.Id,
                    Subnode              = m.Subnode,
                    Code                 = m.Code,
                    Name                 = m.Name,
                    Department           = m.Department,
                    ChiefSpecialist      = m.ChiefSpecialist,
                    GroupLeader          = m.GroupLeader,
                    MainBuilder          = m.MainBuilder,
                    EditedDate           = m.EditedDate,
                    Signed1Id            = m.Signed1Id,
                    Signed2Id            = m.Signed2Id,
                    IssuedDate           = m.IssuedDate,
                    NumOfVolumes         = m.NumOfVolumes,
                    SafetyCoeff          = m.SafetyCoeff,
                    OperatingTemp        = m.OperatingTemp,
                    OperatingZone        = m.OperatingZone,
                    GasGroup             = m.GasGroup,
                    Aggressiveness       = m.Aggressiveness,
                    Material             = m.Material,
                    PaintworkType        = m.PaintworkType,
                    Note                 = m.Note,
                    FireHazardCategoryId = m.FireHazardCategoryId,
                    HighTensileBolts     = m.HighTensileBolts,
                    P_transport          = m.P_transport,
                    P_site               = m.P_site,
                    Xcnd                 = m.Xcnd,
                    Text_3d_estimate     = m.Text_3d_estimate,
                    AddVolumes           = m.AddVolumes,
                    VmpWeight            = m.VmpWeight,
                    Impl_3d_estimate     = m.Impl_3d_estimate,
                });
            }
            var context = GetContext(marks);
            var repo    = new SqlMarkRepo(context);

            int id   = _rnd.Next(1, marks.Count());
            var mark = marks.FirstOrDefault(v => v.Id == id);

            mark.Name = "NewUpdate";

            // Act
            repo.Update(mark);

            // Assert
            Assert.Equal(mark.Name, repo.GetById(id).Name);

            context.Database.EnsureDeleted();
            context.Dispose();
        }
コード例 #2
0
        public void Update_ShouldUpdateMark()
        {
            // Arrange
            var marks = new List <Mark> {
            };

            foreach (var m in TestData.marks)
            {
                marks.Add(new Mark
                {
                    Id                   = m.Id,
                    Subnode              = m.Subnode,
                    Code                 = m.Code,
                    Name                 = m.Name,
                    Department           = m.Department,
                    ChiefSpecialist      = m.ChiefSpecialist,
                    GroupLeader          = m.GroupLeader,
                    NormContr            = m.NormContr,
                    EditedDate           = m.EditedDate,
                    Signed1Id            = m.Signed1Id,
                    Signed2Id            = m.Signed2Id,
                    IssueDate            = m.IssueDate,
                    NumOfVolumes         = m.NumOfVolumes,
                    PaintworkType        = m.PaintworkType,
                    Note                 = m.Note,
                    FireHazardCategoryId = m.FireHazardCategoryId,
                    PTransport           = m.PTransport,
                    PSite                = m.PSite,
                });
            }
            var context = GetContext(marks);
            var repo    = new SqlMarkRepo(context);

            int id   = _rnd.Next(1, marks.Count());
            var mark = marks.FirstOrDefault(v => v.Id == id);

            mark.Name = "NewUpdate";

            // Act
            repo.Update(mark);

            // Assert
            Assert.Equal(mark.Name, repo.GetById(id).Name);

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