Beispiel #1
0
        public void VerifyThatDragOverParameterWorks()
        {
            var containerRow = new RequirementsSpecificationRowViewModel(this.reqSpec, this.session.Object, null);
            var row          = new RequirementRowViewModel(this.req, this.session.Object, containerRow);

            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);

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

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

            this.req.ParameterValue.Add(new SimpleParameterValue()
            {
                ParameterType = param
            });
            row.DragOver(dropinfo.Object);
            Assert.AreEqual(dropinfo.Object.Effects, DragDropEffects.None);
        }
Beispiel #2
0
        public void VerifyThatComparerWorks()
        {
            var spec = new RequirementsSpecification();
            var grp  = new RequirementsGroup()
            {
                ShortName = "a"
            };
            var req1 = new Requirement {
                ShortName = "a"
            };
            var req2 = new Requirement {
                ShortName = "b"
            };
            var req3 = new Requirement {
                ShortName = "x"
            };

            spec.Requirement.Add(req1);
            spec.Requirement.Add(req2);
            spec.Requirement.Add(req3);

            var specRow = new RequirementsSpecificationRowViewModel(spec, this.session.Object, null);
            var grprow  = new RequirementsGroupRowViewModel(grp, this.session.Object, null, specRow);
            var reqrow  = new RequirementRowViewModel(req1, this.session.Object, specRow);
            var reqrow2 = new RequirementRowViewModel(req2, this.session.Object, specRow);
            var reqrow3 = new RequirementRowViewModel(req3, this.session.Object, specRow);

            Assert.AreEqual(-1, comparer.Compare(reqrow, reqrow2));
            Assert.AreEqual(-1, comparer.Compare(reqrow, grprow));
            Assert.AreEqual(1, comparer.Compare(grprow, reqrow));
            Assert.AreEqual(-1, comparer.Compare(reqrow3, grprow));
            Assert.AreEqual(1, comparer.Compare(grprow, reqrow3));
        }
Beispiel #3
0
        public void Verify_that_when_the_requirement_categorized_the_category_shortnames_are_set()
        {
            this.requirement.Category.Add(this.category_1);
            this.requirement.Category.Add(this.category_2);

            var rowViewModel = new RequirementRowViewModel(this.requirement, this.session.Object, null);

            Assert.That(rowViewModel.Categories, Is.EqualTo("REQ, FUNC"));
        }
Beispiel #4
0
        public void VerifyThatDefinitionIsUpdatedCorrectly()
        {
            var containerRow = new RequirementsSpecificationRowViewModel(this.reqSpec, this.session.Object, null);

            var row = new RequirementRowViewModel(this.req, this.session.Object, containerRow);

            this.def.Content = "update";
            CDPMessageBus.Current.SendObjectChangeEvent(this.def, EventKind.Updated);
            Assert.AreEqual("update", row.Definition);
        }
Beispiel #5
0
        public void VerifyThatRequirementVerificationStateOfComplianceIsSetForRequirementRow()
        {
            var containerRow = new RequirementsSpecificationRowViewModel(this.reqSpec, this.session.Object, null);
            var row          = new RequirementRowViewModel(this.req, this.session.Object, containerRow);

            CDPMessageBus.Current.SendMessage(new RequirementStateOfComplianceChangedEvent(RequirementStateOfCompliance.Calculating), this.req);
            Assert.AreEqual(RequirementStateOfCompliance.Calculating, row.RequirementStateOfCompliance);

            CDPMessageBus.Current.SendMessage(new RequirementStateOfComplianceChangedEvent(RequirementStateOfCompliance.Pass), this.req);
            Assert.AreEqual(RequirementStateOfCompliance.Pass, row.RequirementStateOfCompliance);
        }
Beispiel #6
0
        public void VerifyThatPropertiesAreSet()
        {
            var containerRow = new RequirementsSpecificationRowViewModel(this.reqSpec, this.session.Object, null);

            var row = new RequirementRowViewModel(this.req, this.session.Object, containerRow);

            Assert.AreEqual("requirement1", row.Name);
            Assert.AreEqual("r1", row.ShortName);
            Assert.AreSame(this.domain, row.Owner);
            Assert.AreEqual(this.def.Content, row.Definition);
        }
Beispiel #7
0
        public void VerifyThatDropParameterTypeWorks()
        {
            var containerRow = new RequirementsSpecificationRowViewModel(this.reqSpec, this.session.Object, null);
            var row          = new RequirementRowViewModel(this.req, this.session.Object, containerRow);

            var param    = new BooleanParameterType();
            var tuple    = new Tuple <ParameterType, MeasurementScale>(param, null);
            var dropinfo = new Mock <IDropInfo>();

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

            row.Drop(dropinfo.Object);
            this.session.Verify(x => x.Write(It.IsAny <OperationContainer>()));
        }
Beispiel #8
0
        public void VerifyThatWhenCategoryIsDroppedDalIsCalled()
        {
            var containerRow = new RequirementsSpecificationRowViewModel(this.reqSpec, this.session.Object, null);
            var row          = new RequirementRowViewModel(this.req, this.session.Object, containerRow);
            var category     = new Category(Guid.NewGuid(), this.assembler.Cache, this.uri);

            var dropinfo = new Mock <IDropInfo>();

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

            row.Drop(dropinfo.Object);
            this.session.Verify(x => x.Write(It.IsAny <OperationContainer>()));
        }
Beispiel #9
0
        public void VerifyThatStartDragOnRequirementRowReturnsExpectedPayloadAndEffect()
        {
            var dragInfo = new Mock <IDragInfo>();

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

            var containerRow = new RequirementsSpecificationRowViewModel(this.reqSpec, this.session.Object, null);
            var row          = new RequirementRowViewModel(this.req, this.session.Object, containerRow);

            row.StartDrag(dragInfo.Object);

            Assert.AreEqual(this.req, dragInfo.Object.Payload);
            Assert.AreEqual(DragDropEffects.All, dragInfo.Object.Effects);
        }
Beispiel #10
0
        public void VerifyThatRequirementDefinitionIsSetWhenNewLine()
        {
            this.req.Definition.Clear();
            var definition = new Definition()
            {
                Content = "some text\nsome other text", LanguageCode = "en"
            };

            this.req.Definition.Add(definition);

            var containerRow = new RequirementsSpecificationRowViewModel(this.reqSpec, this.session.Object, null);
            var row          = new RequirementRowViewModel(this.req, this.session.Object, containerRow);

            Assert.AreEqual("some text...", row.Definition);
        }
Beispiel #11
0
        public void VerifyThatIfReqSpecIsSetToDeprecatedContainerRequirementsAreAlsoSetToDeprecated()
        {
            var containerRow = new RequirementsSpecificationRowViewModel(this.reqSpec, this.session.Object, null);
            var row          = new RequirementRowViewModel(this.req, this.session.Object, containerRow);

            Assert.IsFalse(row.IsDeprecated);

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

            this.reqSpec.IsDeprecated = true;
            revision.SetValue(this.reqSpec, 2);

            CDPMessageBus.Current.SendObjectChangeEvent(this.reqSpec, EventKind.Updated);

            Assert.IsTrue(row.IsDeprecated);
        }
Beispiel #12
0
        public void VerifyThatIfaCategoryIsAlreadyAppliedItCannotBeDroppedOnARequirement()
        {
            var containerRow = new RequirementsSpecificationRowViewModel(this.reqSpec, this.session.Object, null);
            var row          = new RequirementRowViewModel(this.req, this.session.Object, containerRow);

            var category = new Category(Guid.NewGuid(), this.assembler.Cache, this.uri);

            this.req.Category.Add(category);

            var dropinfo = new Mock <IDropInfo>();

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

            row.DragOver(dropinfo.Object);

            Assert.AreEqual(DragDropEffects.None, dropinfo.Object.Effects);
        }
Beispiel #13
0
        public void VerifyThatACategoryCanBeDroppedOnARequirement()
        {
            var containerRow = new RequirementsSpecificationRowViewModel(this.reqSpec, this.session.Object, null);
            var row          = new RequirementRowViewModel(this.req, this.session.Object, containerRow);

            var category = new Category(Guid.NewGuid(), this.assembler.Cache, this.uri);

            category.PermissibleClass.Add(ClassKind.Requirement);

            var dropinfo = new Mock <IDropInfo>();

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

            row.DragOver(dropinfo.Object);

            Assert.AreEqual(DragDropEffects.Copy, dropinfo.Object.Effects);
        }
Beispiel #14
0
        public void VerifyThatDisplayAdjustmentsWorks()
        {
            var containerRow = new RequirementsSpecificationRowViewModel(this.reqSpec, this.session.Object, null);
            var row          = new RequirementRowViewModel(this.req, this.session.Object, containerRow);

            Assert.AreEqual(containerRow.IsParametricConstraintDisplayed, false);
            Assert.AreEqual(containerRow.IsSimpleParameterValuesDisplayed, false);

            Assert.AreEqual(row.IsParametricConstraintDisplayed, false);
            Assert.AreEqual(row.IsSimpleParameterValuesDisplayed, false);

            Assert.AreEqual(containerRow.ContainedRows.Count, 3);
            Assert.AreEqual(row.ContainedRows.Count, 0);

            containerRow.IsParametricConstraintDisplayed  = true;
            containerRow.IsSimpleParameterValuesDisplayed = true;

            Assert.AreEqual(row.IsParametricConstraintDisplayed, true);
            Assert.AreEqual(row.IsSimpleParameterValuesDisplayed, true);

            Assert.AreEqual(containerRow.ContainedRows.Count, 4);
            Assert.AreEqual(row.ContainedRows.Count, 2);
        }
Beispiel #15
0
        public void Verify_that_when_requirement_is_not_categorized_categories_property_is_default_hyphen()
        {
            var rowViewModel = new RequirementRowViewModel(this.requirement, this.session.Object, null);

            Assert.That(rowViewModel.Categories, Is.EqualTo("-"));
        }