상속: Part
예제 #1
0
        public void TestSaveCommand()
        {
            var modifiableView = new Mock<IModifiable>();
            var notify = new Mock<IUserNotify>();
            var ctx = new Mock<ISecurityContext>();
            var spoolRepo = new Mock<ISpoolRepository>();
            var pipeRepo = new Mock<IPipeRepository>();
            var inspectorRepo = new Mock<IInspectorRepository>();

            var spool = new Prizm.Domain.Entity.Construction.Spool();
            var pipe = new Prizm.Domain.Entity.Mill.Pipe();

            pipeRepo.Setup(x => x.GetAvailableForCutPipes()).Returns(new List<Prizm.Domain.Entity.Mill.Pipe>());

            var spoolRepos = new Mock<ISpoolRepositories>();

            spoolRepos.SetupGet(_ => _.PipeRepo).Returns(pipeRepo.Object);
            spoolRepos.SetupGet(_ => _.RepoInspector).Returns(inspectorRepo.Object);
            spoolRepos.SetupGet(_ => _.SpoolRepo).Returns(spoolRepo.Object);


            modifiableView.SetupGet(x => x.IsModified).Returns(false);


            var viewModel = new SpoolViewModel(
                spoolRepos.Object,
                Guid.Empty,
                notify.Object,
                ctx.Object);

            viewModel.Spool = spool;
            viewModel.Pipe = pipe;
            viewModel.InspectionTestResults =
                new BindingList<InspectionTestResult>() { new InspectionTestResult()
                    {Status = PartInspectionStatus.Pending}};

            viewModel.ModifiableView = modifiableView.Object;

            var command = new SaveSpoolCommand(
                viewModel,
                spoolRepos.Object,
                notify.Object,
                ctx.Object);

            viewModel.SpoolLength = 200;
            viewModel.InitPipeLenght = 1000;
            viewModel.Pipe.Length = 800;
            viewModel.Pipe.Number = "Test";
            viewModel.Spool.Number = "Test";

            command.Execute();

            spoolRepos.Verify(_ => _.BeginTransaction(), Times.Once());
            spoolRepo.Verify(_ => _.SaveOrUpdate(It.IsAny<Prizm.Domain.Entity.Construction.Spool>()), Times.Once());
            spoolRepos.Verify(_ => _.Commit(), Times.Once());
            spoolRepo.Verify(_ => _.Evict(It.IsAny<Prizm.Domain.Entity.Construction.Spool>()), Times.Once());
        }
예제 #2
0
 public void NewSpool()
 {
     Spool        = new Prizm.Domain.Entity.Construction.Spool();
     Spool.Number = string.Empty;
     Spool.InspectionTestResults = new BindingList <InspectionTestResult>();
     Spool.Pipe = new Pipe();
     Spool.ConstructionStatus = PartConstructionStatus.Pending;
     Spool.InspectionStatus   = PartInspectionStatus.Pending;
     Pipe = new Pipe();
     if (this.FilesFormViewModel != null)
     {
         this.FilesFormViewModel.RefreshFiles(this.Spool.Id);
     }
 }
예제 #3
0
      public SpoolObject(Spool spool)
      {
         this.Id = spool.Id;
         this.IsActive = spool.IsActive;
         this.PipeNumber = spool.PipeNumber;
         this.Number = spool.Number;
         this.Length = spool.Length;
         this.IsAvailableToJoint = spool.IsAvailableToJoint;
         this.ConstructionStatus = spool.ConstructionStatus;
         this.InspectionStatus = spool.InspectionStatus;

         if (spool.Attachments != null)
         {
             this.Attachments = new List<FileObject>();
             foreach (var file in spool.Attachments)
             {
                 Attachments.Add(new FileObject(file));
             }
         }
      }
예제 #4
0
 public void NewSpool()
 {
     Spool = new Prizm.Domain.Entity.Construction.Spool();
     Spool.Number = string.Empty;
     Spool.InspectionTestResults = new BindingList<InspectionTestResult>();
     Spool.Pipe = new Pipe();
     Spool.ConstructionStatus = PartConstructionStatus.Pending;
     Spool.InspectionStatus = PartInspectionStatus.Pending;
     Spool.IsAvailableToJoint = true;
     Pipe = new Pipe();
     if(this.FilesFormViewModel != null)
     {
         this.FilesFormViewModel.Files = null;
     }
 }
예제 #5
0
        public void TestSaveCommand()
        {
            var modifiableView = new Mock <IModifiable>();
            var notify         = new Mock <IUserNotify>();
            var ctx            = new Mock <ISecurityContext>();
            var spoolRepo      = new Mock <ISpoolRepository>();
            var pipeRepo       = new Mock <IPipeRepository>();
            var inspectorRepo  = new Mock <IInspectorRepository>();

            var spool = new Prizm.Domain.Entity.Construction.Spool();
            var pipe  = new Prizm.Domain.Entity.Mill.Pipe();

            pipeRepo.Setup(x => x.GetAvailableForCutPipes()).Returns(new List <Prizm.Domain.Entity.Mill.Pipe>());

            var spoolRepos = new Mock <ISpoolRepositories>();

            spoolRepos.SetupGet(_ => _.PipeRepo).Returns(pipeRepo.Object);
            spoolRepos.SetupGet(_ => _.RepoInspector).Returns(inspectorRepo.Object);
            spoolRepos.SetupGet(_ => _.SpoolRepo).Returns(spoolRepo.Object);


            modifiableView.SetupGet(x => x.IsModified).Returns(false);


            var viewModel = new SpoolViewModel(
                spoolRepos.Object,
                Guid.Empty,
                notify.Object,
                ctx.Object);

            viewModel.Spool = spool;
            viewModel.Pipe  = pipe;
            viewModel.InspectionTestResults =
                new BindingList <InspectionTestResult>()
            {
                new InspectionTestResult()
                {
                    Status = PartInspectionStatus.Pending
                }
            };

            viewModel.ModifiableView = modifiableView.Object;

            var command = new SaveSpoolCommand(
                viewModel,
                spoolRepos.Object,
                notify.Object,
                ctx.Object);

            viewModel.SpoolLength    = 200;
            viewModel.InitPipeLenght = 1000;
            viewModel.Pipe.Length    = 800;
            viewModel.Pipe.Number    = "Test";
            viewModel.Spool.Number   = "Test";

            command.Execute();

            spoolRepos.Verify(_ => _.BeginTransaction(), Times.Once());
            spoolRepo.Verify(_ => _.SaveOrUpdate(It.IsAny <Prizm.Domain.Entity.Construction.Spool>()), Times.Once());
            spoolRepos.Verify(_ => _.Commit(), Times.Once());
            spoolRepo.Verify(_ => _.Evict(It.IsAny <Prizm.Domain.Entity.Construction.Spool>()), Times.Once());
        }