Beispiel #1
0
        public void Setup()
        {
            RxApp.MainThreadScheduler = Scheduler.CurrentThread;
            this.serviceLocator       = new Mock <IServiceLocator>();
            this.navigation           = new Mock <IThingDialogNavigationService>();
            ServiceLocator.SetLocatorProvider(() => this.serviceLocator.Object);
            this.serviceLocator.Setup(x => x.GetInstance <IThingDialogNavigationService>()).Returns(this.navigation.Object);
            this.permissionService = new Mock <IPermissionService>();
            this.permissionService.Setup(x => x.CanRead(It.IsAny <Thing>())).Returns(true);
            this.permissionService.Setup(x => x.CanWrite(It.IsAny <Thing>())).Returns(true);
            this.session = new Mock <ISession>();
            this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object);

            this.domain = new DomainOfExpertise(Guid.NewGuid(), null, null)
            {
                Name = "n", ShortName = "s"
            };
            var person = new Person(Guid.NewGuid(), null, null)
            {
                Container = this.siteDir
            };

            this.session.Setup(x => x.ActivePerson).Returns(person);
            var simpleUnit = new SimpleUnit(Guid.NewGuid(), null, null);

            this.siteDir = new SiteDirectory(Guid.NewGuid(), null, null);
            this.siteDir.Person.Add(person);
            var testScale = new LogarithmicScale();
            var referenceQuantityValue = new ScaleReferenceQuantityValue(Guid.NewGuid(), null, null);

            this.rdl = new SiteReferenceDataLibrary(Guid.NewGuid(), null, null)
            {
                Name = "testRDL", ShortName = "test"
            };
            this.rdl.Unit.Add(simpleUnit);
            this.rdl.Scale.Add(testScale);
            var svd1 = new ScaleValueDefinition(Guid.NewGuid(), null, null)
            {
                Name = "ReferenceSVD", ShortName = "RSVD"
            };
            var svd2 = new ScaleValueDefinition(Guid.NewGuid(), null, null)
            {
                Name = "DependentSVD", ShortName = "DSVD"
            };

            this.logarithmicScale = new LogarithmicScale(Guid.NewGuid(), null, null)
            {
                Name = "logarithmicScale", ShortName = "dqk"
            };
            referenceQuantityValue.Scale = this.logarithmicScale;

            this.logarithmicScale.ValueDefinition.Add(svd1);
            this.logarithmicScale.ValueDefinition.Add(svd2);
            this.logarithmicScale.ReferenceQuantityValue.Add(referenceQuantityValue);
            this.rdl.ParameterType.Add(new SimpleQuantityKind {
                Name = "testSQK", ShortName = "tSQK"
            });
            this.siteDir.SiteReferenceDataLibrary.Add(this.rdl);

            var transactionContext = TransactionContextResolver.ResolveContext(this.siteDir);

            this.transaction = new ThingTransaction(transactionContext, null);

            this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(this.siteDir);
            this.session.Setup(x => x.OpenReferenceDataLibraries).Returns(new HashSet <ReferenceDataLibrary>(this.siteDir.SiteReferenceDataLibrary));

            var dal = new Mock <IDal>();

            this.session.Setup(x => x.DalVersion).Returns(new Version(1, 1, 0));
            this.session.Setup(x => x.Dal).Returns(dal.Object);
            dal.Setup(x => x.MetaDataProvider).Returns(new MetaDataProvider());

            this.viewmodel = new LogarithmicScaleDialogViewModel(this.logarithmicScale, this.transaction, this.session.Object, true, ThingDialogKind.Create, this.navigation.Object);
        }
Beispiel #2
0
        public void VerifyThatParameterlessContructorExists()
        {
            var dialogViewModel = new LogarithmicScaleDialogViewModel();

            Assert.IsFalse(dialogViewModel.IsReadOnly);
        }