Inheritance: ViewModelBase, IDisposable
 public MillPipeSearchCommand(
     MillPipeSearchViewModel viewModel,
     IPipeRepository repo,
     IUserNotify notify)
 {
     this.viewModel = viewModel;
     this.repo = repo;
     this.notify = notify;
 }
Beispiel #2
0
 public MillPipeSearchCommand(
     MillPipeSearchViewModel viewModel,
     IPipeRepository repo,
     IUserNotify notify)
 {
     this.viewModel = viewModel;
     this.repo      = repo;
     this.notify    = notify;
 }
Beispiel #3
0
        private void MillPipeSearchXtraForm_Load(object sender, System.EventArgs e)
        {
            viewModel = (MillPipeSearchViewModel)Program.Kernel.GetService(typeof(MillPipeSearchViewModel));

            EnumWrapper <PipeMillStatus> .LoadItems(localizedAllPipeMillStatus);

            BindCommands();
            BindToViewModel();

            weldingDate.SetLimits();
            externalCoatingDate.SetLimits();
            internalCoatingDate.SetLimits();
            localizedSearchResultGroup.Add(searchResultLayoutGroup.Text);
        }
Beispiel #4
0
        private void MillPipeSearchXtraForm_Load(object sender, System.EventArgs e)
        {
            viewModel = (MillPipeSearchViewModel)Program.Kernel.GetService(typeof(MillPipeSearchViewModel));

            foreach (var item in EnumWrapper <PipeMillStatus> .EnumerateItems())
            {
                localizedAllPipeMillStatus.Add(item.Item2);
            }

            BindCommands();
            BindToViewModel();

            weldingDate.SetLimits();
            externalCoatingDate.SetLimits();
            internalCoatingDate.SetLimits();
        }
Beispiel #5
0
 private void MillPipeSearchXtraForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     commandManager.Dispose();
     viewModel.Dispose();
     viewModel = null;
 }
        private void MillPipeSearchXtraForm_Load(object sender, System.EventArgs e)
        {
            viewModel = (MillPipeSearchViewModel)Program.Kernel.GetService(typeof(MillPipeSearchViewModel));

            EnumWrapper<PipeMillStatus>.LoadItems(localizedAllPipeMillStatus);

            BindCommands();
            BindToViewModel();

            weldingDate.SetLimits();
            externalCoatingDate.SetLimits();
            internalCoatingDate.SetLimits();
            localizedSearchResultGroup.Add(searchResultLayoutGroup.Text);
        }
 private void MillPipeSearchXtraForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     commandManager.Dispose();
     viewModel.Dispose();
     viewModel = null;
 }
        public void TestMillPipeSearchCommand()
        {
            var iQuery = new Mock<IQuery>();
            var iSQLQuery = new Mock<ISQLQuery>();

            var notify = new Mock<IUserNotify>();
            var repoPipe = new Mock<IPipeRepository>();
            var repoPlate = new Mock<IPlateRepository>();
            var repoHeat = new Mock<IHeatRepository>();
            var repoWeld = new Mock<IWeldRepository>();
            var repoPipeType = new Mock<IMillPipeSizeTypeRepository>();
            var repoPurchaseOrder = new Mock<IPurchaseOrderRepository>();
            var repoWelder = new Mock<IWelderRepository>();
            var repoPipeTestResult = new Mock<IPipeTestResultRepository>();
            var repoPipeTest = new Mock<IPipeTestRepository>();
            var repoInspector = new Mock<IInspectorRepository>();

            Mock<IMillRepository> millRepos = new Mock<IMillRepository>();
            millRepos.SetupGet(_ => _.RepoPipe).Returns(repoPipe.Object);
            millRepos.SetupGet(_ => _.RepoPlate).Returns(repoPlate.Object);
            millRepos.SetupGet(_ => _.RepoHeat).Returns(repoHeat.Object);
            millRepos.SetupGet(_ => _.RepoWeld).Returns(repoWeld.Object);
            millRepos.SetupGet(_ => _.RepoPipeType).Returns(repoPipeType.Object);
            millRepos.SetupGet(_ => _.RepoPurchaseOrder).Returns(repoPurchaseOrder.Object);
            millRepos.SetupGet(_ => _.WelderRepo).Returns(repoWelder.Object);
            millRepos.SetupGet(_ => _.RepoPipeTestResult).Returns(repoPipeTestResult.Object);
            millRepos.SetupGet(_ => _.RepoPipeTest).Returns(repoPipeTest.Object);
            millRepos.SetupGet(_ => _.RepoInspector).Returns(repoInspector.Object);



            var pipes = new List<Pipe>();
            {
                new Prizm.Domain.Entity.Mill.Pipe { Number = "test-1" };
                new Prizm.Domain.Entity.Mill.Pipe { Number = "test-3" };
            };


            var viewModel = new MillPipeSearchViewModel(millRepos.Object, notify.Object);
            viewModel.PipeNumber = "Test Number";
            viewModel.CheckedPipeTypes = new List<PipeMillSizeType>();

            iQuery.Setup(x => x.List<Pipe>())
                .Returns(pipes).Verifiable();

            iSQLQuery.Setup(x => x.SetResultTransformer(It.IsAny<IResultTransformer>()))
                .Returns(iQuery.Object).Verifiable();

            repoPipe.Setup(x => x.CreateSQLQuery(It.IsAny<string>()))
                .Returns(iSQLQuery.Object).Verifiable();

            var command = new MillPipeSearchCommand(viewModel, repoPipe.Object, notify.Object);

            command.Execute();

            repoPipe.Verify(x => x.CreateSQLQuery(It.IsAny<string>()), Times.Once());

            Assert.AreEqual(
                repoPipe.Object
                .CreateSQLQuery(It.IsAny<string>())
                .SetResultTransformer(It.IsAny<IResultTransformer>())
                .List<Pipe>(), pipes);

        }