public void VerifyThaRowActiveDomainIsCorrectlyPopulated()
        {
            var domain1 = new DomainOfExpertise(Guid.NewGuid(), null, this.uri);
            var domain2 = new DomainOfExpertise(Guid.NewGuid(), null, this.uri);
            var domain3 = new DomainOfExpertise(Guid.NewGuid(), null, this.uri);
            var domain4 = new DomainOfExpertise(Guid.NewGuid(), null, this.uri);

            domain1.IsDeprecated = true;
            domain4.IsDeprecated = true;

            this.siteDirClone.Domain.Add(domain1);
            this.siteDirClone.Domain.Add(domain2);
            this.siteDirClone.Domain.Add(domain3);
            this.siteDirClone.Domain.Add(domain4);

            var engineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), this.cache, this.uri);

            engineeringModelSetup.ActiveDomain.Add(domain1);
            engineeringModelSetup.ActiveDomain.Add(domain2);

            this.cache.TryAdd(new CacheKey(engineeringModelSetup.Iid, null), new Lazy <Thing>(() => engineeringModelSetup));

            var transactionContext = TransactionContextResolver.ResolveContext(this.siteDirectory);
            var transaction        = new ThingTransaction(transactionContext, this.siteDirClone);

            this.viewModel = new EngineeringModelSetupDialogViewModel(engineeringModelSetup.Clone(false), transaction, this.session.Object, true, ThingDialogKind.Update, null, this.siteDirClone);

            // Count of visible items
            var visibleDomains = this.viewModel.PossibleActiveDomain.Count(d => d.IsVisible);

            Assert.AreEqual(2, visibleDomains);

            this.viewModel.ShowDeprecatedDomains = true;
            visibleDomains = this.viewModel.PossibleActiveDomain.Count(d => d.IsVisible);
            Assert.AreEqual(4, visibleDomains);

            var enabledDomains = this.viewModel.PossibleActiveDomain.Count(d => d.IsEnabled);

            Assert.AreEqual(2, enabledDomains);

            var deprecatedDomains = this.viewModel.PossibleActiveDomain.Count(d => d.IsDeprecated);

            Assert.AreEqual(2, deprecatedDomains);

            Assert.AreEqual(this.viewModel.PossibleActiveDomain[0].Name, domain1.Name);
        }
Пример #2
0
        public void VerifyThatActiveDomainIsCorrectlyPopulated()
        {
            var domain1 = new DomainOfExpertise(Guid.NewGuid(), null, this.uri);
            var domain2 = new DomainOfExpertise(Guid.NewGuid(), null, this.uri);
            var domain3 = new DomainOfExpertise(Guid.NewGuid(), null, this.uri);

            this.siteDirClone.Domain.Add(domain1);
            this.siteDirClone.Domain.Add(domain2);
            this.siteDirClone.Domain.Add(domain3);

            var engineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), this.cache, this.uri);

            engineeringModelSetup.ActiveDomain.Add(domain1);

            this.cache.TryAdd(new CacheKey(engineeringModelSetup.Iid, null), new Lazy <Thing>(() => engineeringModelSetup));

            var transactionContext = TransactionContextResolver.ResolveContext(this.siteDirectory);
            var transaction        = new ThingTransaction(transactionContext, this.siteDirClone);

            this.viewModel = new EngineeringModelSetupDialogViewModel(engineeringModelSetup.Clone(false), transaction, this.session.Object, true, ThingDialogKind.Update, null, this.siteDirClone);

            Assert.AreEqual(3, this.viewModel.PossibleActiveDomain.Count);
            Assert.AreEqual(1, this.viewModel.ActiveDomain.Count);
        }