コード例 #1
0
ファイル: PartSpecificationTests.cs プロジェクト: Allors/apps
        public void GivenConstraintSpecification_WhenBuild_ThenPreviousObjectStateIsNull()
        {
            var specification = new ConstraintSpecificationBuilder(this.DatabaseSession).WithDescription("specification").Build();

            this.DatabaseSession.Derive(true);

            Assert.IsNull(specification.PreviousObjectState);
        }
コード例 #2
0
ファイル: PartSpecificationTests.cs プロジェクト: Allors/apps
        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);
        }
コード例 #3
0
ファイル: PartSpecificationTests.cs プロジェクト: Allors/apps
        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);
        }
コード例 #4
0
        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);
        }