public void PureObjectBase_UpdateInstance_DifferentObject()
        {
            var objectBase      = new PureObjectTest(TestLoggerFactory);
            var objectBaseClone = new PureObjectTest(TestLoggerFactory);

            objectBaseClone.UpdateInstance(objectBase).ObjectVersion.Should().Be(objectBaseClone.ObjectVersion);
        }
        public void PureObjectBase_UpdateInstance_SameObject()
        {
            var objectBase    = new PureObjectTest(TestLoggerFactory);
            var objectVersion = objectBase.ObjectVersion;

            objectBase.UpdateInstance(objectBase).ObjectVersion.Should().Be(objectVersion + 1);
        }
        public void PureObjectBase_IncrementObjectVersion()
        {
            var objectBase1   = new PureObjectTest(TestLoggerFactory);
            var objectVersion = objectBase1.ObjectVersion;

            objectBase1.IncreaseObjectVersion().Should().Be(objectVersion + 1);
            objectBase1.ObjectVersion.Should().Be(objectVersion + 1);
        }
        public void PureObjectBase_UpdateInstance_Null()
        {
            var objectBase = new PureObjectTest(TestLoggerFactory);

            Func <IPureObject> fx = () => objectBase.UpdateInstance(null);

            fx.Should().Throw <ArgumentNullException>().And.ParamName.Should().Be("objectUpdate");
        }
        public void PureObjectBase_Comparison()
        {
            var objectBase1 = new PureObjectTest(TestLoggerFactory);
            var objectBase2 = new PureObjectTest(TestLoggerFactory);

            Assert.False(objectBase1.Equals(objectBase2), "objectBase1.Equals(objectBase2)");
            Assert.False(objectBase1.IsSameObjectId(objectBase2), "objectBase1.IsSameObjectId(objectBase2)");
            Assert.True(objectBase1.IsSameObjectVersion(objectBase2), "objectBase1.IsSameObjectVersion(objectBase2)");
        }
        public void PureObjectBase_UpdateInstance_CopyInstance()
        {
            var objectBase      = new PureObjectTest(TestLoggerFactory);
            var objectBaseClone = objectBase.CopyInstance();

            objectBase.IncreaseObjectVersion();

            objectBaseClone.UpdateInstance(objectBase).ObjectVersion.Should().Be(objectBaseClone.ObjectVersion);
        }
        public void PureObjectBase_Clone()
        {
            var objectBase1 = new PureObjectTest(TestLoggerFactory);
            var objectBase2 = objectBase1.CloneInstance();

            // Objects version is the same but everyone else
            Assert.False(objectBase1.Equals(objectBase2), "objectBase1.Equals(objectBase2)");
            Assert.False(objectBase1.IsSameObjectId(objectBase2), "objectBase1.IsSameObjectId(objectBase2)");
            Assert.True(objectBase1.IsSameObjectVersion(objectBase2), "objectBase1.IsSameObjectVersion(objectBase2)");
        }
        public void PureObjectBase_Equals_CloneInstance()
        {
            var objectBase1 = new PureObjectTest(TestLoggerFactory);
            var objectBase2 = objectBase1.CloneInstance();

            // ObjectId's are same but Creation and Modification dates are different
            Assert.False(objectBase1.Equals(objectBase2), "objectBase1.Equals(objectBase2)");
            Assert.False(objectBase1.IsSameObjectId(objectBase2), "objectBase1.IsSameObjectId(objectBase2)");
            Assert.True(objectBase1.IsSameObjectVersion(objectBase2), "objectBase1.IsSameObjectVersion(objectBase2)");
        }
        public void PureObjectBase_CompareTo()
        {
            var objectBase = new PureObjectTest(TestLoggerFactory);

            objectBase.CompareTo(null).Should().Be(1);
        }
        public void PureObjectBase_GetHashCode()
        {
            var objectBase = new PureObjectTest(TestLoggerFactory);

            objectBase.GetHashCode().Should().Be(objectBase.ObjectId.GetHashCode());
        }
        public void PureObjectBase_ToStringLoggable()
        {
            var objectBase = new PureObjectTest(TestLoggerFactory);

            TestOutputHelper.WriteLine(objectBase.ToString(LogLevel.Debug, LoggableFormat.ToStringWithParents));
        }
        public void PureObjectBase_ToString()
        {
            var objectBase = new PureObjectTest(TestLoggerFactory);

            TestOutputHelper.WriteLine(objectBase.ToString());
        }