Exemple #1
0
        public void VerifyThatGroupMayBeDraggedWithPermission()
        {
            var domainOfExpertise = new DomainOfExpertise(Guid.NewGuid(), this.assembler.Cache, this.uri);
            var elementDefinition = new ElementDefinition(Guid.NewGuid(), this.assembler.Cache, this.uri);

            elementDefinition.Owner = domainOfExpertise;
            var parameterGroup = new ParameterGroup(Guid.NewGuid(), this.assembler.Cache, this.uri);

            elementDefinition.ParameterGroup.Add(parameterGroup);
            this.iteration.Element.Add(elementDefinition);

            var row      = new ParameterGroupRowViewModel(parameterGroup, domainOfExpertise, this.session.Object, null);
            var draginfo = new Mock <IDragInfo>();

            draginfo.SetupProperty(x => x.Payload);
            draginfo.SetupProperty(x => x.Effects);

            row.StartDrag(draginfo.Object);

            Assert.AreEqual(DragDropEffects.All, draginfo.Object.Effects);
            Assert.AreSame(parameterGroup, draginfo.Object.Payload);
        }
Exemple #2
0
        public void VerifyThatGroupMayNotBeDraggedWithoutPermission()
        {
            this.permissionService.Setup(x => x.CanWrite(It.IsAny <Thing>())).Returns(false);

            var domainOfExpertise = new DomainOfExpertise(Guid.NewGuid(), this.assembler.Cache, this.uri);
            var elementDefinition = new ElementDefinition(Guid.NewGuid(), this.assembler.Cache, this.uri);

            elementDefinition.Owner = domainOfExpertise;
            var parameterGroup = new ParameterGroup(Guid.NewGuid(), this.assembler.Cache, this.uri);

            elementDefinition.ParameterGroup.Add(parameterGroup);
            this.iteration.Element.Add(elementDefinition);

            var row      = new ParameterGroupRowViewModel(parameterGroup, domainOfExpertise, this.session.Object, null);
            var draginfo = new Mock <IDragInfo>();

            draginfo.SetupProperty(x => x.Payload);
            draginfo.SetupProperty(x => x.Effects);

            row.StartDrag(draginfo.Object);

            Assert.AreEqual(DragDropEffects.None, draginfo.Object.Effects);
        }