public void GetById_DictionaryNotNull() { AppSettingsDictionaryResolverBase configurationResolverBase = new AppSettingsDictionaryResolverBase("DictionaryConfiguration.json", "Dictionary1"); var Dictionary = configurationResolverBase.GetById("Config1"); Assert.NotNull(Dictionary); }
public void GetById_CountShouldBe3() { AppSettingsDictionaryResolverBase configurationResolverBase = new AppSettingsDictionaryResolverBase("DictionaryConfiguration.json", "Dictionary1"); var Dictionary = configurationResolverBase.GetById("Config2"); Assert.AreEqual(Dictionary.Count, 3); }
public void GetById_ShouldFail() { AppSettingsDictionaryResolverBase configurationResolverBase = new AppSettingsDictionaryResolverBase("DictionaryConfiguration.json", "Dictionary1"); Assert.Throws <ArgumentException>(() => configurationResolverBase.GetById("db99") ); }
public void GenerateValidToken_ShouldPass() { var Dictionary = _configurationResolverBase.GetById("db1"); JwtService service = new JwtService(Dictionary["Key"], Dictionary["ValidIssuer"]); JwtPayload InitialPayload; InitialPayload = new JwtPayload { { "UserOid ", "001" }, { JwtRegisteredClaimNames.Iat, service.DateToNumber(DateTime.Now).ToString() }, { JwtRegisteredClaimNames.Iss, Dictionary["ValidIssuer"] }, }; var StringToken = service.JwtPayloadToToken(InitialPayload); Debug.WriteLine(string.Format("{0}:{1}", "Token", StringToken)); Assert.True(service.VerifyToken(StringToken)); }
public void ConfigurationResolverBase_ResolveRuntime_ShouldPass() { AppSettingsDictionaryResolverBase configurationResolverBase = new AppSettingsDictionaryResolverBase("TestDictionaryConfiguration.json", "Dictionary1"); //var builder = new ConfigurationBuilder() // .SetBasePath(Directory.GetCurrentDirectory()) // .AddJsonFile("appsettings.json"); //builder.Build(); var NewConfig = File.ReadAllText("NewDictionaryConfiguration.json"); File.WriteAllText("TestDictionaryConfiguration.json", NewConfig); var NewItem = configurationResolverBase.GetById("NewItem"); Assert.NotNull(NewItem); }