public void GivenConstraintSpecification_WhenBuild_ThenPreviousObjectStateIsNull() { var specification = new ConstraintSpecificationBuilder(this.DatabaseSession).WithDescription("specification").Build(); this.DatabaseSession.Derive(true); Assert.IsNull(specification.PreviousObjectState); }
public void GivenConstraintSpecification_WhenBuild_ThenLastObjectStateEqualsCurrencObjectState() { var specification = new ConstraintSpecificationBuilder(this.DatabaseSession).WithDescription("specification").Build(); this.DatabaseSession.Derive(true); Assert.AreEqual(new PartSpecificationObjectStates(this.DatabaseSession).Created, specification.CurrentObjectState); Assert.AreEqual(specification.LastObjectState, specification.CurrentObjectState); }
public void GivenConstraintSpecification_WhenConfirmed_ThenCurrentSpecificationStatusMustBeDerived() { var specification = new ConstraintSpecificationBuilder(this.DatabaseSession).WithDescription("specification").Build(); this.DatabaseSession.Derive(true); Assert.AreEqual(1, specification.PartSpecificationStatuses.Count); Assert.AreEqual(new PartSpecificationObjectStates(this.DatabaseSession).Created, specification.CurrentPartSpecificationStatus.PartSpecificationObjectState); specification.Approve(); this.DatabaseSession.Derive(true); Assert.AreEqual(2, specification.PartSpecificationStatuses.Count); Assert.AreEqual(new PartSpecificationObjectStates(this.DatabaseSession).Approved, specification.CurrentPartSpecificationStatus.PartSpecificationObjectState); }
public void GivenConstraintSpecification_WhenDeriving_ThenRequiredRelationsMustExist() { var builder = new ConstraintSpecificationBuilder(this.DatabaseSession); var specification = builder.Build(); Assert.IsTrue(this.DatabaseSession.Derive().HasErrors); this.DatabaseSession.Rollback(); builder.WithDescription("Description"); specification = builder.Build(); Assert.IsFalse(this.DatabaseSession.Derive().HasErrors); Assert.AreEqual(specification.CurrentPartSpecificationStatus.PartSpecificationObjectState, new PartSpecificationObjectStates(this.DatabaseSession).Created); Assert.AreEqual(specification.CurrentObjectState, new PartSpecificationObjectStates(this.DatabaseSession).Created); Assert.AreEqual(specification.CurrentObjectState, specification.LastObjectState); }