Пример #1
0
        public void VerifyThatDragOverParameterWorks()
        {
            var containerRow = new RequirementsSpecificationRowViewModel(this.spec1, this.session.Object, null);
            var param        = new BooleanParameterType();
            var tuple        = new Tuple <ParameterType, MeasurementScale>(param, null);
            var dropinfo     = new Mock <IDropInfo>();

            dropinfo.Setup(x => x.Payload).Returns(tuple);
            dropinfo.SetupProperty(x => x.Effects);

            this.permissionService.Setup(x => x.CanWrite(ClassKind.RequirementsContainerParameterValue, It.IsAny <RequirementsSpecification>())).Returns(false);

            containerRow.DragOver(dropinfo.Object);
            Assert.AreEqual(DragDropEffects.None, dropinfo.Object.Effects);

            this.permissionService.Setup(x => x.CanWrite(ClassKind.RequirementsContainerParameterValue, It.IsAny <RequirementsSpecification>())).Returns(true);
            containerRow.DragOver(dropinfo.Object);
            Assert.AreEqual(DragDropEffects.Copy, dropinfo.Object.Effects);

            this.spec1.ParameterValue.Add(new RequirementsContainerParameterValue {
                ParameterType = param
            });
            containerRow.DragOver(dropinfo.Object);
            Assert.AreEqual(DragDropEffects.None, dropinfo.Object.Effects);
        }
Пример #2
0
        public void VerifyDragOver()
        {
            this.permissionService.Setup(x => x.CanWrite(It.IsAny <ClassKind>(), It.IsAny <Thing>())).Returns(true);
            var row = new RequirementsSpecificationRowViewModel(this.spec1, this.session.Object, null);

            var dropinfo = new Mock <IDropInfo>();

            dropinfo.Setup(x => x.Effects).Returns(DragDropEffects.Move);
            dropinfo.Setup(x => x.Payload).Returns(this.req1);

            row.DragOver(dropinfo.Object);
            Assert.AreEqual(DragDropEffects.Move, dropinfo.Object.Effects);

            dropinfo.Setup(x => x.Payload).Returns(this.grp1);
            row.DragOver(dropinfo.Object);
            Assert.AreEqual(DragDropEffects.Move, dropinfo.Object.Effects);

            dropinfo.Setup(x => x.Payload).Returns(this.iteration);
            row.DragOver(dropinfo.Object);
            dropinfo.VerifySet(x => x.Effects = DragDropEffects.None);
        }