Exemple #1
0
        public void TryParse_returns_false_for_invalid_input(string value)
        {
            var success = DocumentReference.TryParse(value, out var parsed);

            success.Should().BeFalse();
            parsed.Should().BeNull();
        }
Exemple #2
0
        public void TryParse_returns_true_for_self_references(string reference)
        {
            // ARRANGE

            // ACT
            var success = DocumentReference.TryParse(reference, out var parsed);

            // ASSERT
            success
            .Should().BeTrue();

            parsed
            .Should().NotBeNull()
            .And.BeOfType <SelfDocumentReference>();
        }
Exemple #3
0
        public void TryParse_returns_true_for_same_version_references(string reference, string name)
        {
            // ARRANGE
            var expectedName = new DocumentName(name);

            // ACT
            var success = DocumentReference.TryParse(reference, out var parsed);

            // ASSERT
            success
            .Should().BeTrue();

            parsed
            .Should().NotBeNull()
            .And.BeOfType <SameVersionDocumentReference>()
            .Which.Name.Should().Be(expectedName);
        }
Exemple #4
0
        public void TryParse_returns_true_for_same_name_docs_references(string reference, string version)
        {
            // ARRANGE
            var expectedVersion = NuGetVersion.Parse(version);

            // ACT
            var success = DocumentReference.TryParse(reference, out var parsed);

            // ASSERT
            success
            .Should().BeTrue();

            parsed
            .Should().NotBeNull()
            .And.BeOfType <SameNameDocumentReference>()
            .And.Match <SameNameDocumentReference>(r => r.Version == expectedVersion);
        }
Exemple #5
0
        public void Parse_returns_true_for_fully_qualified_docs_references(string reference, string name, string version)
        {
            // ARRANGE
            var expectedIdentity = new DocumentIdentity(new DocumentName(name), NuGetVersion.Parse(version));

            // ACT
            var success = DocumentReference.TryParse(reference, out var parsed);

            // ASSERT
            success
            .Should().BeTrue();

            parsed
            .Should().NotBeNull()
            .And.BeOfType <FullyQualifiedDocumentReference>()
            .And.Match <FullyQualifiedDocumentReference>(fqr => fqr.Identity == expectedIdentity);
        }