public void GetDictionary_DefaultCultureInfo_ReturnsRegisteredInstance()
        {
            IResourceProvider resourceProvider = new ResourceProvider();

            RegisterFirstDictionary(resourceProvider);

            var expected = resourceProvider.GetDictionary(Constants.Dictionary1.Name);
            var actual   = resourceProvider.GetDictionary(Constants.Dictionary1.Name);

            Assert.AreEqual(Constants.RuRu.Dictionary1Path, actual.Source.AbsoluteUri);
            Assert.AreEqual(Constants.RuRu.Dictionary1Path, expected.Source.AbsoluteUri);
            Assert.AreEqual(expected, actual);
        }
        public void GetDictionary_DictionaryNotRegistered_Throws()
        {
            IResourceProvider resourceProvider = new ResourceProvider();

            RegisterFirstDictionary(resourceProvider);

            Assert.Throws <DictionaryNotRegisteredException>(
                () => resourceProvider.GetDictionary(Constants.Dictionary2.Name));
        }
        public void GetDictionary_UnknownCultureInfo_ReturnsRegisteredInstance()
        {
            IResourceProvider resourceProvider = new ResourceProvider();

            RegisterFirstDictionary(resourceProvider);
            RegisterSecondDictionary(resourceProvider);
            var defaultDictionary1 = resourceProvider.GetDictionary(Constants.Dictionary1.Name);
            var defaultDictionary2 = resourceProvider.GetDictionary(Constants.Dictionary2.Name);

            resourceProvider.CultureInfo = CultureInfo.GetCultureInfo("fr-FR");
            var frDictionary1 = resourceProvider.GetDictionary(Constants.Dictionary1.Name);
            var frDictionary2 = resourceProvider.GetDictionary(Constants.Dictionary2.Name);

            var actual1 = resourceProvider.GetDictionary(Constants.Dictionary1.Name);
            var actual2 = resourceProvider.GetDictionary(Constants.Dictionary2.Name);

            Assert.AreEqual(Constants.RuRu.Dictionary1Path, defaultDictionary1.Source.AbsoluteUri);
            Assert.AreEqual(Constants.RuRu.Dictionary1Path, frDictionary1.Source.AbsoluteUri);
            Assert.AreEqual(Constants.RuRu.Dictionary1Path, actual1.Source.AbsoluteUri);
            Assert.AreEqual(defaultDictionary1, frDictionary1);
            Assert.AreEqual(defaultDictionary1, actual1);
            Assert.AreEqual(frDictionary1, actual1);

            Assert.AreEqual(Constants.Default.Dictionary2Path, defaultDictionary2.Source.AbsoluteUri);
            Assert.AreEqual(Constants.Default.Dictionary2Path, frDictionary2.Source.AbsoluteUri);
            Assert.AreEqual(Constants.Default.Dictionary2Path, actual2.Source.AbsoluteUri);
            Assert.AreEqual(defaultDictionary2, frDictionary2);
            Assert.AreEqual(defaultDictionary2, actual2);
            Assert.AreEqual(frDictionary2, actual2);
        }
        public void GetDictionary_ChangedCultureInfo_ReturnsRegisteredInstance()
        {
            IResourceProvider resourceProvider = new ResourceProvider();

            RegisterFirstDictionary(resourceProvider);
            RegisterSecondDictionary(resourceProvider);
            var defaultDictionary1 = resourceProvider.GetDictionary(Constants.Dictionary1.Name);
            var defaultDictionary2 = resourceProvider.GetDictionary(Constants.Dictionary2.Name);

            resourceProvider.CultureInfo = CultureInfo.GetCultureInfo("en-US");
            var enUsDictionary1 = resourceProvider.GetDictionary(Constants.Dictionary1.Name);
            var enUsDictionary2 = resourceProvider.GetDictionary(Constants.Dictionary2.Name);

            var actual1 = resourceProvider.GetDictionary(Constants.Dictionary1.Name);
            var actual2 = resourceProvider.GetDictionary(Constants.Dictionary2.Name);

            Assert.AreEqual(Constants.RuRu.Dictionary1Path, defaultDictionary1.Source.AbsoluteUri);
            Assert.AreEqual(Constants.EnUs.Dictionary1Path, enUsDictionary1.Source.AbsoluteUri);
            Assert.AreEqual(Constants.EnUs.Dictionary1Path, actual1.Source.AbsoluteUri);
            Assert.AreNotEqual(defaultDictionary1, enUsDictionary1);
            Assert.AreNotEqual(defaultDictionary1, actual1);
            Assert.AreEqual(enUsDictionary1, actual1);

            Assert.AreEqual(Constants.Default.Dictionary2Path, defaultDictionary2.Source.AbsoluteUri);
            Assert.AreEqual(Constants.Default.Dictionary2Path, enUsDictionary2.Source.AbsoluteUri);
            Assert.AreEqual(Constants.Default.Dictionary2Path, actual2.Source.AbsoluteUri);
            Assert.AreEqual(defaultDictionary2, enUsDictionary2);
            Assert.AreEqual(defaultDictionary2, actual2);
            Assert.AreEqual(enUsDictionary2, actual2);
        }