public void GetDyntaxaRevisionReferenceRelation_WhenTwoReferenceRelationWithSameRelatedObjectGUIDExists_ThenTwoReferenceRelationIsReturned()
        {
            // Arrange
            const int    revisionId        = 24;
            const string relatedObjectGUID = "urn:lsid:dyntaxa.se:Taxon:6010174";
            const string rel1Action        = "Add";
            const string rel2Action        = "Delete";

            DyntaxaManager.CreateDyntaxaRevisionReferenceRelation(
                GetRevisionContext(),
                WebDyntaxaReferenceRelationTestFactory.Create(revisionId, relatedObjectGUID, rel1Action));
            DyntaxaManager.CreateDyntaxaRevisionReferenceRelation(
                GetRevisionContext(),
                WebDyntaxaReferenceRelationTestFactory.Create(revisionId, relatedObjectGUID, rel2Action));

            // Act
            var newReferenceRelations = DyntaxaManager.GetDyntaxaRevisionReferenceRelation(
                GetRevisionContext(), revisionId, relatedObjectGUID);

            // Assert
            Assert.IsNotNull(newReferenceRelations);
            Assert.AreEqual(2, newReferenceRelations.Count);
            Assert.AreEqual(rel1Action, newReferenceRelations[0].Action);
            Assert.AreEqual(rel2Action, newReferenceRelations[1].Action);
        }
        public void CreateDyntaxaRevisionReferenceRelation_WithValidData_ThenDyntaxaRevisionReferenceRelationIsCreated()
        {
            // Arrange
            const string relatedObjectGUID = "urn:lsid:dyntaxa.se:Taxon:6010174";
            const string action = "Add";
            const int    revisionId = 1;
            WebDyntaxaRevisionReferenceRelation dyntaxaReferenceRelation, newDyntaxaReferenceRelation;

            dyntaxaReferenceRelation = WebDyntaxaReferenceRelationTestFactory.Create(
                revisionId, relatedObjectGUID, action);

            // Act
            // Create test Dyntaxa revision reference relation.
            dyntaxaReferenceRelation.ReferenceId = 3342;
            newDyntaxaReferenceRelation          = DyntaxaManager.CreateDyntaxaRevisionReferenceRelation(
                GetRevisionContext(),
                dyntaxaReferenceRelation);

            // Assert
            Assert.IsNotNull(newDyntaxaReferenceRelation);
            Assert.AreNotEqual(dyntaxaReferenceRelation.Id, newDyntaxaReferenceRelation.Id);
            Assert.AreEqual(dyntaxaReferenceRelation.RelatedObjectGUID, newDyntaxaReferenceRelation.RelatedObjectGUID);
            Assert.AreEqual(3342, newDyntaxaReferenceRelation.ReferenceId);
            Assert.AreEqual(GetContext().GetUser().Id, newDyntaxaReferenceRelation.CreatedBy);
        }
        public void GetAllDyntaxaRevisionReferenceRelations_WhenReferenceRelationExists_ThenReferenceRelationIsReturned()
        {
            //Arrange
            List <WebDyntaxaRevisionReferenceRelation> referenceRelations;
            const int    revisionId               = 24;
            const string relatedObjectGUID        = "urn:lsid:dyntaxa.se:Taxon:6010174";
            const string action                   = "Add";
            var          dyntaxaReferenceRelation = WebDyntaxaReferenceRelationTestFactory.Create(
                revisionId, relatedObjectGUID, action);

            DyntaxaManager.CreateDyntaxaRevisionReferenceRelation(GetRevisionContext(), dyntaxaReferenceRelation);

            // Act
            referenceRelations = DyntaxaManager.GetAllDyntaxaRevisionReferenceRelations(
                GetRevisionContext(), revisionId);

            // Assert
            Assert.AreEqual(1, referenceRelations.Count);
        }
        public void GetDyntaxaRevisionReferenceRelation_WhenWrongRevisionId_ThenEmptyListIsReturned()
        {
            // Arrange
            const int    revisionId               = 24;
            const int    wrongRevisionId          = 25;
            const string relatedObjectGUID        = "urn:lsid:dyntaxa.se:Taxon:6010174";
            const string action                   = "Add";
            var          dyntaxaReferenceRelation = WebDyntaxaReferenceRelationTestFactory.Create(
                revisionId, relatedObjectGUID, action);

            DyntaxaManager.CreateDyntaxaRevisionReferenceRelation(GetRevisionContext(), dyntaxaReferenceRelation);

            // Act
            var newReferenceRelations = DyntaxaManager.GetDyntaxaRevisionReferenceRelation(
                GetRevisionContext(), wrongRevisionId, relatedObjectGUID);

            // Assert
            Assert.IsNotNull(newReferenceRelations);
            Assert.AreEqual(0, newReferenceRelations.Count);
        }
        public void GetDyntaxaRevisionReferenceRelationById_WhenDyntaxaRevisionReferenceRelationCreated_ThenCreatedRevisionReferenceRelationIsReturned()
        {
            // Arrange
            const int    revisionId        = 24;
            const string relatedObjectGUID = "urn:lsid:dyntaxa.se:Taxon:6010174";
            const string action            = "Add";
            const int    referenceId       = 252;
            WebDyntaxaRevisionReferenceRelation dyntaxaReferenceRelation = WebDyntaxaReferenceRelationTestFactory.Create(
                revisionId, relatedObjectGUID, action);

            dyntaxaReferenceRelation.ReferenceId = referenceId;
            var newReferenceRelations = DyntaxaManager.CreateDyntaxaRevisionReferenceRelation(
                GetRevisionContext(), dyntaxaReferenceRelation);

            // Act
            WebDyntaxaRevisionReferenceRelation getReferenceRelations = DyntaxaManager.GetDyntaxaRevisionReferenceRelationById(
                GetRevisionContext(), newReferenceRelations.Id);

            // Assert
            Assert.IsNotNull(getReferenceRelations);
            Assert.AreEqual(relatedObjectGUID, getReferenceRelations.RelatedObjectGUID);
            Assert.AreEqual(action, getReferenceRelations.Action);
            Assert.AreEqual(referenceId, getReferenceRelations.ReferenceId);
        }