コード例 #1
0
        public void VerifyThatRdlShortnameIsUpdated()
        {
            var vm = new ConstantsBrowserViewModel(this.session.Object, this.siteDirectory, null, null, null, null);

            var sRdl = new SiteReferenceDataLibrary(Guid.NewGuid(), this.assembler.Cache, this.uri);

            sRdl.Container = this.siteDirectory;

            var cat = new Constant(Guid.NewGuid(), this.assembler.Cache, this.uri)
            {
                Name = "cat1", ShortName = "1", Container = sRdl
            };
            var cat2 = new Constant(Guid.NewGuid(), this.assembler.Cache, this.uri)
            {
                Name = "cat2", ShortName = "2", Container = sRdl
            };

            CDPMessageBus.Current.SendObjectChangeEvent(cat, EventKind.Added);
            CDPMessageBus.Current.SendObjectChangeEvent(cat2, EventKind.Added);

            var rev = typeof(Thing).GetProperty("RevisionNumber");

            rev.SetValue(sRdl, 3);
            sRdl.ShortName = "test";

            CDPMessageBus.Current.SendObjectChangeEvent(sRdl, EventKind.Updated);
            Assert.IsTrue(vm.Constants.All(x => x.ContainerRdl == "test"));
        }
コード例 #2
0
        public void Setup()
        {
            RxApp.MainThreadScheduler = Scheduler.CurrentThread;

            this.session           = new Mock <ISession>();
            this.dialogNavigation  = new Mock <IThingDialogNavigationService>();
            this.navigation        = new Mock <IPanelNavigationService>();
            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.permissionService.Setup(x => x.CanWrite(It.IsAny <ClassKind>(), It.IsAny <Thing>())).Returns(true);

            this.uri       = new Uri("http://www.rheagroup.com");
            this.assembler = new Assembler(this.uri);

            this.siteDirectory = new SiteDirectory(Guid.NewGuid(), this.assembler.Cache, this.uri)
            {
                Name = "site directory"
            };
            this.person = new Person(Guid.NewGuid(), this.assembler.Cache, this.uri)
            {
                GivenName = "John", Surname = "Doe"
            };

            this.openRdlList = new List <ReferenceDataLibrary>(this.siteDirectory.SiteReferenceDataLibrary);
            this.session.Setup(x => x.ActivePerson).Returns(this.person);
            this.session.Setup(x => x.Assembler).Returns(this.assembler);

            this.browser = new ConstantsBrowserViewModel(this.session.Object, this.siteDirectory, this.dialogNavigation.Object, this.navigation.Object, null, null);
        }
コード例 #3
0
        public void VerifyThatConstantsFromExistingRdlsAreLoaded()
        {
            var siterefenceDataLibrary = new SiteReferenceDataLibrary(Guid.NewGuid(), null, null);
            var constant1 = new Constant(Guid.NewGuid(), null, null);
            var constant2 = new Constant(Guid.NewGuid(), null, null);

            siterefenceDataLibrary.Constant.Add(constant1);
            siterefenceDataLibrary.Constant.Add(constant2);
            this.siteDirectory.SiteReferenceDataLibrary.Add(siterefenceDataLibrary);

            var engineeringModelSetup     = new EngineeringModelSetup(Guid.NewGuid(), null, null);
            var modelReferenceDataLibrary = new ModelReferenceDataLibrary(Guid.NewGuid(), null, null);
            var constant3 = new Constant(Guid.NewGuid(), null, null);
            var constant4 = new Constant(Guid.NewGuid(), null, null);

            modelReferenceDataLibrary.Constant.Add(constant3);
            modelReferenceDataLibrary.Constant.Add(constant4);
            engineeringModelSetup.RequiredRdl.Add(modelReferenceDataLibrary);
            this.siteDirectory.Model.Add(engineeringModelSetup);
            this.openRdlList = new List <ReferenceDataLibrary>(this.siteDirectory.SiteReferenceDataLibrary)
            {
                modelReferenceDataLibrary
            };
            this.session.Setup(x => x.OpenReferenceDataLibraries).Returns(new HashSet <ReferenceDataLibrary>(this.openRdlList));

            var browser = new ConstantsBrowserViewModel(this.session.Object, this.siteDirectory, null, null, null, null);

            Assert.AreEqual(4, browser.Constants.Count);
        }