Пример #1
0
        public void ObtainSpecificVersionWithoutFallback()
        {
            // Given
            HashProvider   hp     = new HashProvider();
            IConfiguration config = new TestConfiguration();

            config.Settings.HelpDirectory = "Help";
            HelpBuilderService buildService = new HelpBuilderService(config, hp);
            HelpService        helpService  = new HelpService(buildService);

            string myFakePluginId = Guid.NewGuid().ToString("B");

            CreateFakeHelp(buildService, myFakePluginId, new Version[] { new Version("1.0.0"), new Version("2.0.0") }, new string[] { "fr-FR", "fr", "en" });
            buildService.CreateOrUpdateBuilds();

            // When
            using (Stream helpPackage = helpService.GetHelpPackage(myFakePluginId, new Version("1.0.0"), "fr-FR"))
            {
                // Then
                Assert.That(helpPackage, Is.Not.Null);
                Assert.That(helpPackage.CanRead, Is.True);

                CheckHelpPackage(helpPackage, (m) =>
                {
                    Assert.That(m.Culture, Is.EqualTo("fr-FR"));
                    Assert.That(m.PluginId, Is.EqualTo(myFakePluginId));
                    Assert.That(m.Version, Is.EqualTo("1.0.0"));
                });
            }
        }
Пример #2
0
        public void ObtainSpecificVersionThatDoesNotExists()
        {
            // Given
            HashProvider   hp     = new HashProvider();
            IConfiguration config = new TestConfiguration();

            config.Settings.HelpDirectory = "Help";
            HelpBuilderService buildService = new HelpBuilderService(config, hp);
            HelpService        helpService  = new HelpService(buildService);

            string myFakePluginId = Guid.NewGuid().ToString("B");

            CreateFakeHelp(buildService, myFakePluginId, new Version[] { new Version("1.0.0") }, new string[] { "fr" });
            buildService.CreateOrUpdateBuilds();

            // When
            using (Stream helpPackage = helpService.GetHelpPackage(myFakePluginId, new Version("3.0.0"), "en-US"))
            {
                // Then
                Assert.That(helpPackage, Is.Null);
            }
        }