Inheritance: ViewModelBase, IDisposable
Ejemplo n.º 1
0
        private void RailcarSearchXtraForm_Load(object sender, EventArgs e)
        {
            viewModel = (ReleaseNoteSearchViewModel)Program.Kernel.GetService(typeof(ReleaseNoteSearchViewModel));
            BindCommands();
            BindToViewModel();

            releaseNoteDate.SetLimits();
        }
Ejemplo n.º 2
0
 public SearchReleaseNoteCommand(
     ReleaseNoteSearchViewModel viewmodel,
     IReleaseNoteRepository repo,
     IUserNotify notify)
 {
     this.viewModel = viewmodel;
     this.repo      = repo;
     this.notify    = notify;
 }
Ejemplo n.º 3
0
 private void RailcarSearchXtraForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     commandManager.Dispose();
     if (viewModel != null)
     {
         viewModel.Dispose();
         viewModel = null;
     }
 }
Ejemplo n.º 4
0
        private void RailcarSearchXtraForm_Load(object sender, EventArgs e)
        {
            viewModel = (ReleaseNoteSearchViewModel)Program.Kernel.GetService(typeof(ReleaseNoteSearchViewModel));
            BindCommands();
            BindToViewModel();

            startDate.SetLimits();
            endDate.SetLimits();

            if (localizedSearchResultGroup.Count == 0)
            {
                localizedSearchResultGroup.Add(resultParametersLayoutGroup.Text);
            }
        }
        private void RailcarSearchXtraForm_Load(object sender, EventArgs e)
        {
            viewModel = (ReleaseNoteSearchViewModel)Program.Kernel.GetService(typeof(ReleaseNoteSearchViewModel));
            BindCommands();
            BindToViewModel();

            startDate.SetLimits();
            endDate.SetLimits();

            if (localizedSearchResultGroup.Count == 0)
            {
                localizedSearchResultGroup.Add(resultParametersLayoutGroup.Text);
            }
        }
        public void RailcarSearchTest() 
        {
            var iQuery = new Mock<IQuery>();
            var iSQLQuery = new Mock<ISQLQuery>();
            var notify = new Mock<IUserNotify>();

            Mock<IReleaseNoteRepository> repo = new Mock<IReleaseNoteRepository>();

            var railcars = new List<Prizm.Domain.Entity.Mill.Railcar>();
            {
                new Prizm.Domain.Entity.Mill.Railcar { Number = "Test1" };
                new Prizm.Domain.Entity.Mill.Railcar { Number = "Test2" };
            };


            var viewModel = new ReleaseNoteSearchViewModel(repo.Object, notify.Object);
            viewModel.RailcarNumber = "Test";

            iQuery.Setup(x => x.List<Prizm.Domain.Entity.Mill.Railcar>())
                .Returns(railcars).Verifiable();

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

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

            repo.Setup(x => x.SearchReleases(
                It.IsAny<string>(), 
                It.IsAny<DateTime>(), 
                It.IsAny<DateTime>()))
                .Returns(new List<ReleaseNote>() {new ReleaseNote() });

            repo.Setup(x => x.SearchReleasesAllCreteria(
                It.IsAny<string>(), 
                It.IsAny<DateTime>(), 
                It.IsAny<DateTime>(),
                It.IsAny<string>(),
                It.IsAny<string>(),
                It.IsAny<string>(),
                It.IsAny<string>()
                ))
                .Returns(new List<ReleaseNote>() { new ReleaseNote() });

            repo.Setup(x => x.SearchReleasesByRailcar(
                It.IsAny<string>(),
                It.IsAny<DateTime>(),
                It.IsAny<DateTime>(),
                It.IsAny<string>(),
                It.IsAny<string>(),
                It.IsAny<string>()
                ))
                .Returns(new List<ReleaseNote>() { new ReleaseNote() });

            var command = new SearchReleaseNoteCommand(viewModel, repo.Object, notify.Object);

            command.Execute();

            repo.Verify(x => x.SearchReleasesByRailcar(
                It.IsAny<string>(),
                It.IsAny<DateTime>(),
                It.IsAny<DateTime>(),
                It.IsAny<string>(),
                It.IsAny<string>(),
                It.IsAny<string>()), Times.AtMostOnce());

            repo.Verify(x => x.SearchReleasesAllCreteria(                
                It.IsAny<string>(), 
                It.IsAny<DateTime>(), 
                It.IsAny<DateTime>(),
                It.IsAny<string>(),
                It.IsAny<string>(),
                It.IsAny<string>(),
                It.IsAny<string>()), Times.AtMostOnce());

            repo.Verify(x => x.SearchReleases(
                It.IsAny<string>(), 
                It.IsAny<DateTime>(), 
                It.IsAny<DateTime>()), Times.AtMostOnce());

            Assert.AreEqual(
                repo.Object
                .CreateSQLQuery(It.IsAny<string>())
                .SetResultTransformer(It.IsAny<IResultTransformer>())
                .List<Prizm.Domain.Entity.Mill.Railcar>(), railcars);

        }
 private void RailcarSearchXtraForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     commandManager.Dispose();
     if(viewModel != null)
     {
         viewModel.Dispose();
         viewModel = null;
     }
 }