Пример #1
0
        public void TestShouldCreateTimestamp_Validate_Invalid()
        {
            // Given
            var now    = new DateTime(1850, 12, 21, 7, 7, 7);
            var origin = Origin.Create(Guids.Two(), nameof(TimestampTests), nameof(TestShouldCreateTimestamp_Validate_Invalid));

            // When
            var result = Timestamp.Create(now, origin);

            // Then
            Assert.IsTrue(result.IsInvalid());
        }
Пример #2
0
        public void TestShouldCreateText_Validate_Invalid()
        {
            // Given
            var    origin = Origin.Create(Guids.One(), nameof(TimestampTests), nameof(TestShouldCreateText_Validate_Valid));
            string str    = "  ";

            // When
            var result = Text.Create(str, origin);

            // Then
            Assert.IsTrue(result.IsInvalid());
        }
Пример #3
0
        public void TestShouldCreateTimestamp_Validate_Func_Invalid()
        {
            // Given
            Func <DateTime> now() => () => new DateTime(1899, 12, 21, 7, 7, 7);

            var origin = Origin.Create(Guids.Four(), nameof(TimestampTests), nameof(TestShouldCreateTimestamp_Validate_Func_Invalid));

            // When
            var result = Timestamp.Create(now(), origin);

            // Then
            Assert.IsTrue(result.IsInvalid());
        }
Пример #4
0
        public void TestShouldCreateText_Validate_Valid()
        {
            // Given
            var    origin = Origin.Create(Guids.One(), nameof(TimestampTests), nameof(TestShouldCreateText_Validate_Valid));
            string str    = "Test";

            // When
            var result = Text.Create(str, origin);

            // Then
            Assert.IsTrue(result.IsValid);
            Assert.AreEqual(str, result.GetOrException().ToString());
        }
Пример #5
0
        public void TestShouldCreateTimestamp_Validate_Valid()
        {
            // Given
            var now    = new DateTime(2020, 12, 21, 7, 7, 7);
            var origin = Origin.Create(Guids.One(), nameof(TimestampTests), nameof(TestShouldCreateTimestamp_Validate_Valid));

            // When
            var result = Timestamp.Create(now, origin);

            // Then
            Assert.IsTrue(result.IsValid);
            DateTime actual = result.GetOrException();

            Assert.AreEqual(now, actual);
        }