Ejemplo n.º 1
0
        public void Create_NoRefsNoVersions_ThrowInvalidOperation()
        {
            // Arrange
            var func = new SagaVersionResolver().Create();

            // Assert
            Assert.Throws <InvalidOperationException>(() => func(null, null));
        }
Ejemplo n.º 2
0
        public void Create_NoRefsMultipleVersions_ReturnStepWithHighestVersion()
        {
            // Arrange
            var func = new SagaVersionResolver().Create();

            // Act
            var result = func(null, CreateVersions("1.0.0", "0.0.9", "2.12.1", "12.5.99", "1.4.5"));

            // Assert
            Assert.Equal("12.5.99", result.Single().Version.ToString());
        }
Ejemplo n.º 3
0
        public void Create_NoRefsOneVersion_ReturnStepWithVersion()
        {
            // Arrange
            var func = new SagaVersionResolver().Create();

            // Act
            var result = func(null, CreateVersions("1.0.0"));

            // Assert
            Assert.Equal("1.0.0", result.Single().Version.ToString());
        }
Ejemplo n.º 4
0
        public void Create_RefsVersionMatchesNoMajorMinor_ThrowInvalidOperation()
        {
            // Arrange
            var func = new SagaVersionResolver().Create();
            var refs = new List <ISagaReference>
            {
                new SagaReference(new SagaVersion("1.3.99"), 0, SagaMessageType.Command, Guid.NewGuid(), Guid.NewGuid())
            };

            // Assert
            Assert.Throws <InvalidOperationException>(() => func(refs, CreateVersions("1.0.0", "0.0.9", "2.10.1", "12.5.99", "1.4.5")));
        }
Ejemplo n.º 5
0
        public void Create_RefsWithMultipleReferenceIds_ThrowsInvalidOperation()
        {
            // Arrange
            var func = new SagaVersionResolver().Create();
            var refs = new List <ISagaReference>
            {
                new SagaReference(new SagaVersion("2.4.1"), 0, SagaMessageType.Command, Guid.NewGuid(), Guid.NewGuid()),
                new SagaReference(new SagaVersion("2.4.1"), 0, SagaMessageType.Command, Guid.NewGuid(), Guid.NewGuid()),
                new SagaReference(new SagaVersion("2.4.1"), 0, SagaMessageType.Command, Guid.NewGuid(), Guid.NewGuid())
            };

            // Assert
            Assert.Throws <InvalidOperationException>(() => func(refs, CreateVersions("2.4.5")));
        }
Ejemplo n.º 6
0
        public void Create_RefsVersionMatchesOnMajorMinorHigherPatch_ReturnStepWithHighestPatch()
        {
            // Arrange
            var func = new SagaVersionResolver().Create();
            var refs = new List <ISagaReference>
            {
                new SagaReference(new SagaVersion("1.4.99"), 0, SagaMessageType.Command, Guid.NewGuid(), Guid.NewGuid())
            };

            // Act
            var result = func(refs, CreateVersions("1.0.0", "0.0.9", "2.10.1", "12.5.99", "1.4.5"));

            // Assert
            Assert.Equal("1.4.5", result.Single().Version.ToString());
        }
Ejemplo n.º 7
0
        public void Create_RefsWithDifferentMajorVersions_ReturnStepWithHighestVersion()
        {
            // Arrange
            var func        = new SagaVersionResolver().Create();
            var referenceId = Guid.NewGuid();
            var refs        = new List <ISagaReference>
            {
                new SagaReference(new SagaVersion("2.4.1"), 0, SagaMessageType.Command, referenceId, Guid.NewGuid()),
                new SagaReference(new SagaVersion("1.4.99"), 0, SagaMessageType.Command, referenceId, Guid.NewGuid()),
                new SagaReference(new SagaVersion("1.4.15"), 0, SagaMessageType.Command, referenceId, Guid.NewGuid())
            };

            // Act
            var result = func(refs, CreateVersions("2.4.5"));

            // Assert
            Assert.Equal("2.4.5", result.Single().Version.ToString());
        }