Esempio n. 1
0
        public void SubjectStateTransitionUnmodifiedToDeleted()
        {
            ModelSubject aSubject = new EAVModelLibrary.ModelSubject() { SubjectID = rng.Next() };

            Assert.AreEqual(EAV.Model.ObjectState.New, aSubject.ObjectState, "Object state should be 'New' on creation.");

            aSubject.MarkUnmodified();

            Assert.AreEqual(EAV.Model.ObjectState.Unmodified, aSubject.ObjectState, "Object state failed to transition to 'Unmodified'.");

            aSubject.MarkDeleted();

            Assert.AreEqual(EAV.Model.ObjectState.Deleted, aSubject.ObjectState, "Object state failed to transition to 'Deleted'.");
        }
Esempio n. 2
0
        public void SubjectClearInstancesWhenDeleted()
        {
            ModelSubject aSubject = new EAVModelLibrary.ModelSubject() { SubjectID = rng.Next() };

            Assert.AreEqual(EAV.Model.ObjectState.New, aSubject.ObjectState, "Object state should be 'New' on creation.");

            ModelRootInstance value = new EAVModelLibrary.ModelRootInstance() { InstanceID = rng.Next() };
            aSubject.Instances.Add(value);

            aSubject.MarkUnmodified();
            value.MarkUnmodified();

            Assert.AreEqual(EAV.Model.ObjectState.Unmodified, aSubject.ObjectState, "Object state failed to transition to 'Unmodified'.");
            Assert.AreEqual(EAV.Model.ObjectState.Unmodified, value.ObjectState, "Object state failed to transition to 'Unmodified'.");

            aSubject.MarkDeleted();

            Assert.AreEqual(EAV.Model.ObjectState.Deleted, aSubject.ObjectState, "Object state failed to transition to 'Deleted'.");
            Assert.AreEqual(EAV.Model.ObjectState.Deleted, value.ObjectState, "Object state failed to transition to 'Deleted'.");

            aSubject.Instances.Clear();
        }