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); }
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)); }
public void VerifyThatRequirementVerificationStateOfComplianceIsSetForRequirementSpecificationRow() { var containerRow = new RequirementsSpecificationRowViewModel(this.reqSpec, this.session.Object, null); CDPMessageBus.Current.SendMessage(new RequirementStateOfComplianceChangedEvent(RequirementStateOfCompliance.Calculating), this.reqSpec); Assert.AreEqual(RequirementStateOfCompliance.Calculating, containerRow.RequirementStateOfCompliance); CDPMessageBus.Current.SendMessage(new RequirementStateOfComplianceChangedEvent(RequirementStateOfCompliance.Pass), this.reqSpec); Assert.AreEqual(RequirementStateOfCompliance.Pass, containerRow.RequirementStateOfCompliance); }
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); }
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); }
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>())); }
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>())); }
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); }
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); }
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); }
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); }
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); }
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); }