Ejemplo n.º 1
0
        public void VerifyThatParameterCanBeDropped()
        {
            var row = new ParameterRowViewModel(this.cptParameter, this.session.Object, null, false);

            var group1 = new ParameterGroup(Guid.NewGuid(), this.assembler.Cache, this.uri);
            var group2 = new ParameterGroup(Guid.NewGuid(), this.assembler.Cache, this.uri);

            this.assembler.Cache.TryAdd(new CacheKey(group1.Iid, this.iteration.Iid), new Lazy <Thing>(() => group1));
            this.assembler.Cache.TryAdd(new CacheKey(group2.Iid, this.iteration.Iid), new Lazy <Thing>(() => group2));

            this.elementDefinitionForUsage1.ParameterGroup.Add(group1);
            this.elementDefinitionForUsage1.ParameterGroup.Add(group2);

            this.cptParameter.Group = group1;
            group2.ContainingGroup  = group1;

            this.parameter.Group = null;

            var dropinfo = new Mock <IDropInfo>();

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

            row.DragOver(dropinfo.Object);

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

            row.Drop(dropinfo.Object);
            this.session.Verify(x => x.Write(It.IsAny <OperationContainer>()), Times.Once);
        }
Ejemplo n.º 2
0
        public async Task VerifyThatDropWorksForRelationalExpression()
        {
            var vm = new ParameterRowViewModel(this.parameter, this.session.Object, null, false);

            var dropinfo = new Mock <IDropInfo>();

            dropinfo.Setup(x => x.Payload).Returns(this.relationalExpression);
            dropinfo.Setup(x => x.Effects).Returns(DragDropEffects.Copy);

            dropinfo.SetupProperty(x => x.Effects);
            await vm.Drop(dropinfo.Object);

            this.thingCreator.Verify(x => x.CreateBinaryRelationshipForRequirementVerification(It.IsAny <ISession>(), It.IsAny <Iteration>(), It.IsAny <ParameterOrOverrideBase>(), It.IsAny <RelationalExpression>()), Times.Once);
        }