Example #1
0
        private ReactiveCommand CreateShowScanCertificateCommand(IObservable <bool> canExecuteObservable = null)
        {
            var command = new ReactiveCommand(canExecuteObservable);

            command.IsExecuting.Subscribe(isBusy => IsBusy = isBusy);
            command.RegisterAsyncFunction(_ =>
            {
                var filtering =
                    _filterViewModelFactory.Create <AttachedDocumentFilter, AttachedDocumentDto>();

                filtering.Filter.Document = SelectedCertificateQuality.Rn;

                filtering.Wait();

                var certificateQuality = new CertificateQuality(SelectedCertificateQuality.Rn);
                if (filtering.Result.Any())
                {
                    filtering.Result.MapTo <CertificateQualityAttachedDocument>()
                    .DoForEach(doc => certificateQuality.Documents.Add(doc));
                }

                var viewModel = _routableViewModelManager.Get <IAttachedDocumentViewModel>();
                viewModel.SetHasDocument(certificateQuality);

                return(viewModel);
            }).Subscribe(viewModel => HostScreen.Router.Navigate.Execute(viewModel));

            return(command);
        }
        private void CheckSetParent(CertificateQuality certificateQuality)
        {
            Assert.That(certificateQuality.ChemicalIndicatorValues, Is.Not.Null);
            Assert.That(certificateQuality.Documents, Is.Not.Null);
            Assert.That(certificateQuality.Destinations, Is.Not.Null);
            Assert.That(certificateQuality.Passes, Is.Not.Null);
            Assert.That(certificateQuality.MechanicIndicatorValues, Is.Not.Null);

            certificateQuality.Documents.Add(new AttachedDocument(100));
            Assert.That(certificateQuality.Documents.Count, Is.EqualTo(1));
            Assert.That(certificateQuality.Documents[0].Parent, Is.EqualTo(certificateQuality));

            certificateQuality.ChemicalIndicatorValues.Add(new ChemicalIndicatorValue());
            Assert.That(certificateQuality.ChemicalIndicatorValues.Count, Is.EqualTo(1));
            Assert.That(certificateQuality.ChemicalIndicatorValues[0].CertificateQuality, Is.EqualTo(certificateQuality));

            certificateQuality.MechanicIndicatorValues.Add(new MechanicIndicatorValue());
            Assert.That(certificateQuality.MechanicIndicatorValues.Count, Is.EqualTo(1));
            Assert.That(certificateQuality.MechanicIndicatorValues[0].CertificateQuality, Is.EqualTo(certificateQuality));

            certificateQuality.Passes.Add(new Pass(100));
            Assert.That(certificateQuality.Passes.Count, Is.EqualTo(1));
            Assert.That(certificateQuality.Passes[0].CertificateQuality, Is.EqualTo(certificateQuality));

            certificateQuality.Destinations.Add(new Destination(100));
            Assert.That(certificateQuality.Destinations.Count, Is.EqualTo(1));
            Assert.That(certificateQuality.Destinations[0].CertificateQuality, Is.EqualTo(certificateQuality));
        }
Example #3
0
        public void OpenReportCertificateQualityTest()
        {
            var certificateQuality = new CertificateQuality(100);
            var reportMetadata     = new CertificateQualityReport();

            reportMetadata.SetCertificateQuality(certificateQuality);

            var printManager = MockRepository.GenerateMock <IPrintManager>();

            printManager.OpenReportInBrowser(reportMetadata);
        }
Example #4
0
        public void Test2()
        {
            var cq  = new CertificateQuality(100);
            var doc = new AttachedDocument(100);

            doc.Content = ImagesConverter.ToByteArray(new Bitmap(@"D:\Repositories\HalfbloodApp\Halfblood.UnitTests\Halfblood.UnitTests\36.jpg"));
            cq.Documents.Add(doc);

            var context = new CopyContext <CertificateQuality>(cq);

            context.Commit();
        }
        public void Test()
        {
            var cq = new CertificateQuality(100);

            cq.Documents.Add(new AttachedDocument(102));
            cq.Documents[0].Parent = cq;

            var d         = new AttachedDocumentType(100).MapTo <AttachedDocumentTypeDto>();
            var attachDto = cq.Documents[0].MapTo <AttachedDocumentDto>();

            var dto = cq.MapTo <CertificateQualityDto>();
        }
        public void Test()
        {
            var cq = new CertificateQuality(100);

            _viewModel.SetEditableObject(cq.ChemicalIndicatorValues);
            _viewModel.EditableObject.Add(new ChemicalIndicatorValue());
            _viewModel.ApplyCommand.Execute(null);

            Thread.Sleep(500);

            Assert.That(_viewModel.EditableObject[0].CertificateQuality, Is.Not.Null);
            Assert.That(_viewModel.EditableObject[0].CertificateQuality.Rn, Is.EqualTo(100));
        }
Example #7
0
 public void SetCertificateQuality(CertificateQuality certificateQuality)
 {
     _certificateQuality = certificateQuality;
 }
        public void WithoutMapedCheckSetParent()
        {
            var certificateQuality = new CertificateQuality(100);

            this.CheckSetParent(certificateQuality);
        }