Beispiel #1
0
        public void Read_Client3_And_MapTo_Client4_ProofTest()
        {
            // Arrange
            var tool = new DataMigrationTool(Configuration);

            //Act
            var result = tool.ReadIds3DbAndMapClientsScopesTreeToIds4Schema(true);

            // Assert
            // todo: ApiResourceClaims Scope !!
            var claimsIdSource = result.Item1.Scopes.Where(x => x.Type == 0).SelectMany(x => x.ScopeClaims)
                                 .Select(x => new
            {
                x.Name,
                ScopeName = x.Scope?.Name
            }).ToArray();

            var claimsIdTarget = result.Item2.IdentityResources.Where(x => x.UserClaims != null).SelectMany(x => x.UserClaims)
                                 .Select(x => new
            {
                x.Type,
                x.IdentityResourceId,
                IdentityResourceName = x.IdentityResource?.Name
            }).ToArray();


            var claimsResSource = result.Item1.Scopes.Where(x => x.Type == 1).SelectMany(x => x.ScopeClaims)
                                  .Select(x => new
            {
                x.Name,
                ScopeName = x.Scope?.Name
            }).ToArray();

            var claimsResTarget = result.Item2.ApiResources.Where(x => x.UserClaims != null).SelectMany(x => x.UserClaims)
                                  .Select(x => new
            {
                x.Type,
                x.ApiResourceId,
                ApiResourceName = x.ApiResource?.Name
            }).ToArray();


            Assert.Equal(claimsIdSource.Length, claimsIdTarget.Length);
            Assert.Equal(claimsResSource.Length, claimsResTarget.Length);
        }