Пример #1
0
        /// <summary>
        /// Try to retrieve dependancies from cache if it was already compute, if not try to resolve it
        /// </summary>
        internal Tuple <SemanticVersion, string> RetrieveConflictingDependancyFromCacheOrResolve(SortedDictionary <Tuple <SemanticVersion, string>, DllReference> assemblies,
                                                                                                 DllReference parentAssembly, SortedSet <SemanticVersion> assembliesSemanticVersions,
                                                                                                 AssemblyReference assemblyDependency)
        {
            var asmss = assembliesSemanticVersions
                        .Select(_ =>
            {
                try
                {
                    return(assemblies[new Tuple <SemanticVersion, string>(_, assemblyDependency.Item2)]);
                }
                catch (KeyNotFoundException exc)
                {
                    var excption = new VersionNotFoundException(String.Format("versions.ini is not consistent with assemblies.ini. versions.ini is referencing {1}-{0} while it doesn't exist in Assemblies.ini", _, assemblyDependency.Item2), exc);
                    throw excption;
                }
            })
                        //If Parent assembly is a snapshot we include snapshot in dependency otherwise no because nuget doesn't support
                        // official package with snapshot dependency
                        .Where(_ =>
                               (string.IsNullOrEmpty(parentAssembly.Id.Item1.SpecialVersion) &&
                                !string.IsNullOrEmpty(_.Id.Item1.SpecialVersion))
                        ? false
                        : true
                               );

            var result = ResolveConflictingDependancy(asmss, parentAssembly);

            return(result);
        }
Пример #2
0
        public void ShouldReturnFalseIfVersionNotFoundExceptionIsThrownByCreator()
        {
            // Arrange
            var command   = this.CreateCommand();
            var exception = new VersionNotFoundException("12345");

            this.creator.Setup(
                c => c.Create(It.IsAny <IDatabaseArchive>(), It.IsAny <string>(), It.IsAny <ITaskExecuter>(), It.IsAny <bool>(), It.IsAny <bool>()))
            .Throws(exception);

            // Act
            var result = command.Execute(new[] { "-a", "myArchive" });

            // Assert
            Assert.False(result);
        }
Пример #3
0
        public void ShouldPrintExceptionMessageIfVersionNotFoundExceptionIsThrownByCreator()
        {
            // Arrange
            var command   = this.CreateCommand();
            var exception = new VersionNotFoundException("12345");

            this.creator.Setup(
                c => c.Create(It.IsAny <IDatabaseArchive>(), It.IsAny <string>(), It.IsAny <ITaskExecuter>(), It.IsAny <bool>(), It.IsAny <bool>()))
            .Throws(exception);

            // Act
            command.Execute(new[] { "-a", "myArchive" });

            // Assert
            this.messageService.Verify(m => m.WriteLine(exception.Message));
        }
        public void TestVersionNotFoundException()
        {
            VersionNotFoundException ex = new VersionNotFoundException("Version not found.");
            this.ExecuteExceptionHandler(ex);

            this.mockFactory.VerifyAllExpectationsHaveBeenMet();
        }