public static void Deserialize_serializedString_type___Should_throw_ArgumentException___When_parameter_type_is_not_Version()
        {
            // Arrange
            var systemUnderTest = new ObcVersionStringSerializer();

            // Act
            var actual1 = Record.Exception(() => systemUnderTest.Deserialize("1.2.0", typeof(object)));
            var actual2 = Record.Exception(() => systemUnderTest.Deserialize("1.2.0", typeof(DateTime)));

            // Assert
            actual1.Must().BeOfType <ArgumentException>();
            actual1.Message.Must().BeEqualTo("type != typeof(Version); 'type' is of type 'object'");

            actual2.Must().BeOfType <ArgumentException>();
            actual2.Message.Must().BeEqualTo("type != typeof(Version); 'type' is of type 'DateTime'");
        }
        public static void Deserialize_T___Should_return_null___When_parameter_serializedString_is_null()
        {
            // Arrange
            var systemUnderTest = new ObcVersionStringSerializer();

            // Act
            var actual = systemUnderTest.Deserialize <Version>(null);

            // Assert
            actual.AsTest().Must().BeNull();
        }
        public static void Deserialize_serializedString_type___Should_throw_ArgumentNullException___When_parameter_type_is_null()
        {
            // Arrange
            var systemUnderTest = new ObcVersionStringSerializer();

            // Act
            var actual = Record.Exception(() => systemUnderTest.Deserialize("1.0", null));

            // Assert
            actual.Must().BeOfType <ArgumentNullException>();
            actual.Message.Must().ContainString("type");
        }
        public static void Deserialize_T___Should_deserialize_version___When_called()
        {
            // Arrange
            var systemUnderTest = new ObcVersionStringSerializer();

            var scenarios = new List <(Version Expected, string SerializedString)>
            {
                (new Version(), "0.0"),
                (new Version(5, 20), "5.20"),
                (new Version(5, 20, 43), "5.20.43"),
                (new Version(5, 20, 43, 69), "5.20.43.69"),
            };

            // Act
            var actual = scenarios.Select(_ => systemUnderTest.Deserialize <Version>(_.SerializedString)).ToList();

            // Assert
            actual.AsTest().Must().BeEqualTo(scenarios.Select(_ => _.Expected).ToList());
        }
        public static void Deserialize_T___Should_throw_InvalidOperationException___When_parameter_serializedString_is_malformed()
        {
            // Arrange
            var systemUnderTest = new ObcVersionStringSerializer();

            var serializedStrings = new[]
            {
                string.Empty,
                "not-a-version",
                "-1.2.3",
            };

            // Act
            var actual = serializedStrings.Select(_ => Record.Exception(() => systemUnderTest.Deserialize <Version>(_))).ToList();

            // Assert
            actual.AsTest().Must().Each().BeOfType <InvalidOperationException>();
            actual.Select(_ => _.Message).AsTest().Must().Each().ContainString("The serialized Version is malformed");
        }