diff --git a/.gitignore b/.gitignore index 3d70d1068..336afb2a4 100644 --- a/.gitignore +++ b/.gitignore @@ -220,3 +220,4 @@ FakesAssemblies/ /SPMeta2.v2.ncrunchsolution /SPMeta2/SPMeta2.Standard/SPMeta2.Standard.csproj.DotSettings /SPMeta2/SPMeta2/SPMeta2.csproj.DotSettings +/SPMeta2/SubPointSolutions.Docs/Views-Output diff --git a/README.md b/README.md index 75c68a56a..ad9841188 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,12 @@ The most comprehensive, enterprise-ready framework for provisioning SharePoint a * Documented: API samples, guidances and documentation * Enterprise ready: regression tests, localization, SLA -### Build status -[![Build status](https://ci.appveyor.com/api/projects/status/0ym3fts7hmrdjvy1?svg=true)](https://ci.appveyor.com/project/SubPointSupport/spmeta2) +### Build status +| Branch | Status | +| ------------- | ------------- | +| dev | [![Build status](https://ci.appveyor.com/api/projects/status/0ym3fts7hmrdjvy1/branch/dev?svg=true)](https://ci.appveyor.com/project/SubPointSupport/spmeta2/branch/dev) | +| beta | [![Build status](https://ci.appveyor.com/api/projects/status/0ym3fts7hmrdjvy1/branch/beta?svg=true)](https://ci.appveyor.com/project/SubPointSupport/spmeta2/branch/beta) | +| master| [![Build status](https://ci.appveyor.com/api/projects/status/0ym3fts7hmrdjvy1/branch/master?svg=true)](https://ci.appveyor.com/project/SubPointSupport/spmeta2/branch/master) | ### SPMeta2 in details diff --git a/SPMeta2.sln b/SPMeta2.sln index 8f30130db..24c200434 100644 --- a/SPMeta2.sln +++ b/SPMeta2.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 +VisualStudioVersion = 12.0.30501.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Provision", "Provision", "{8A0307D3-5564-4034-9DB1-D13FEE1DADD9}" EndProject @@ -16,6 +16,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_3rd party", "_3rd party", "{EE9BD842-2CA9-45B2-AB7C-A8EB0353AAB7}" ProjectSection(SolutionItems) = preProject .gitignore = .gitignore + appveyor-v12.yml = appveyor-v12.yml appveyor.yml = appveyor.yml README.md = README.md SPMeta2.snk = SPMeta2.snk @@ -112,264 +113,145 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SubPointSolutions.Docs", "S EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build", "SPMeta2\Build\Build.csproj", "{B9AD05BB-B576-46B8-89A0-FBC70C438B64}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Provision.Nintex", "Provision.Nintex", "{543E02CC-AA4A-4B1F-ABBD-2C88CFAA463C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPMeta2.Nintex", "SPMeta2\SPMeta2.Nintex\SPMeta2.Nintex.csproj", "{D19B0907-CED5-416A-9D45-0F112990C234}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPMeta2.Nintex.CSOM", "SPMeta2\SPMeta2.Nintex.CSOM\SPMeta2.Nintex.CSOM.csproj", "{588FC30F-1C85-410E-AB20-C9741DB28857}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPMeta2.Nintex.SSOM", "SPMeta2\SPMeta2.Nintex.SSOM\SPMeta2.Nintex.SSOM.csproj", "{788D7D6E-5347-4D09-BFF8-E83AD7CA1FD3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - CI-CSOM2013|Any CPU = CI-CSOM2013|Any CPU - CI-O365|Any CPU = CI-O365|Any CPU Debug|Any CPU = Debug|Any CPU Debug40|Any CPU = Debug40|Any CPU Debug45|Any CPU = Debug45|Any CPU - Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A3A48F9F-1424-41CD-BF92-49D509C715CE}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {A3A48F9F-1424-41CD-BF92-49D509C715CE}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU {A3A48F9F-1424-41CD-BF92-49D509C715CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A3A48F9F-1424-41CD-BF92-49D509C715CE}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU {A3A48F9F-1424-41CD-BF92-49D509C715CE}.Debug40|Any CPU.Build.0 = Debug40|Any CPU {A3A48F9F-1424-41CD-BF92-49D509C715CE}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {A3A48F9F-1424-41CD-BF92-49D509C715CE}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {A3A48F9F-1424-41CD-BF92-49D509C715CE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A3A48F9F-1424-41CD-BF92-49D509C715CE}.Release|Any CPU.Build.0 = Release|Any CPU - {EE49D3FD-6180-40E6-829F-6831FF89DAC6}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {EE49D3FD-6180-40E6-829F-6831FF89DAC6}.CI-CSOM2013|Any CPU.Build.0 = Debug|Any CPU - {EE49D3FD-6180-40E6-829F-6831FF89DAC6}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU - {EE49D3FD-6180-40E6-829F-6831FF89DAC6}.CI-O365|Any CPU.Build.0 = Debug|Any CPU {EE49D3FD-6180-40E6-829F-6831FF89DAC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EE49D3FD-6180-40E6-829F-6831FF89DAC6}.Debug|Any CPU.Build.0 = Debug|Any CPU {EE49D3FD-6180-40E6-829F-6831FF89DAC6}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU {EE49D3FD-6180-40E6-829F-6831FF89DAC6}.Debug40|Any CPU.Build.0 = Debug40|Any CPU {EE49D3FD-6180-40E6-829F-6831FF89DAC6}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {EE49D3FD-6180-40E6-829F-6831FF89DAC6}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {EE49D3FD-6180-40E6-829F-6831FF89DAC6}.Release|Any CPU.ActiveCfg = Debug35|Any CPU - {EE49D3FD-6180-40E6-829F-6831FF89DAC6}.Release|Any CPU.Build.0 = Debug35|Any CPU - {6F7EBF0C-7124-44D6-B9EC-302A54A19FE4}.CI-CSOM2013|Any CPU.ActiveCfg = Debug35|Any CPU - {6F7EBF0C-7124-44D6-B9EC-302A54A19FE4}.CI-CSOM2013|Any CPU.Build.0 = Debug35|Any CPU - {6F7EBF0C-7124-44D6-B9EC-302A54A19FE4}.CI-O365|Any CPU.ActiveCfg = Debug35|Any CPU - {6F7EBF0C-7124-44D6-B9EC-302A54A19FE4}.CI-O365|Any CPU.Build.0 = Debug35|Any CPU {6F7EBF0C-7124-44D6-B9EC-302A54A19FE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6F7EBF0C-7124-44D6-B9EC-302A54A19FE4}.Debug|Any CPU.Build.0 = Debug|Any CPU {6F7EBF0C-7124-44D6-B9EC-302A54A19FE4}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU {6F7EBF0C-7124-44D6-B9EC-302A54A19FE4}.Debug40|Any CPU.Build.0 = Debug40|Any CPU {6F7EBF0C-7124-44D6-B9EC-302A54A19FE4}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {6F7EBF0C-7124-44D6-B9EC-302A54A19FE4}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {6F7EBF0C-7124-44D6-B9EC-302A54A19FE4}.Release|Any CPU.ActiveCfg = Debug|Any CPU - {6F7EBF0C-7124-44D6-B9EC-302A54A19FE4}.Release|Any CPU.Build.0 = Debug|Any CPU - {5E592EAA-E21F-4BF4-8EDF-6F6452DC916A}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {5E592EAA-E21F-4BF4-8EDF-6F6452DC916A}.CI-CSOM2013|Any CPU.Build.0 = Debug|Any CPU - {5E592EAA-E21F-4BF4-8EDF-6F6452DC916A}.CI-O365|Any CPU.ActiveCfg = CI-O365|Any CPU - {5E592EAA-E21F-4BF4-8EDF-6F6452DC916A}.CI-O365|Any CPU.Build.0 = CI-O365|Any CPU {5E592EAA-E21F-4BF4-8EDF-6F6452DC916A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5E592EAA-E21F-4BF4-8EDF-6F6452DC916A}.Debug|Any CPU.Build.0 = Debug|Any CPU {5E592EAA-E21F-4BF4-8EDF-6F6452DC916A}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU {5E592EAA-E21F-4BF4-8EDF-6F6452DC916A}.Debug40|Any CPU.Build.0 = Debug40|Any CPU {5E592EAA-E21F-4BF4-8EDF-6F6452DC916A}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {5E592EAA-E21F-4BF4-8EDF-6F6452DC916A}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {5E592EAA-E21F-4BF4-8EDF-6F6452DC916A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5E592EAA-E21F-4BF4-8EDF-6F6452DC916A}.Release|Any CPU.Build.0 = Release|Any CPU - {4C4A0044-FBE1-46D8-B8DB-EB579831CDB6}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {4C4A0044-FBE1-46D8-B8DB-EB579831CDB6}.CI-CSOM2013|Any CPU.Build.0 = Debug|Any CPU - {4C4A0044-FBE1-46D8-B8DB-EB579831CDB6}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU - {4C4A0044-FBE1-46D8-B8DB-EB579831CDB6}.CI-O365|Any CPU.Build.0 = Debug|Any CPU {4C4A0044-FBE1-46D8-B8DB-EB579831CDB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4C4A0044-FBE1-46D8-B8DB-EB579831CDB6}.Debug|Any CPU.Build.0 = Debug|Any CPU {4C4A0044-FBE1-46D8-B8DB-EB579831CDB6}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU {4C4A0044-FBE1-46D8-B8DB-EB579831CDB6}.Debug40|Any CPU.Build.0 = Debug40|Any CPU {4C4A0044-FBE1-46D8-B8DB-EB579831CDB6}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {4C4A0044-FBE1-46D8-B8DB-EB579831CDB6}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {4C4A0044-FBE1-46D8-B8DB-EB579831CDB6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4C4A0044-FBE1-46D8-B8DB-EB579831CDB6}.Release|Any CPU.Build.0 = Release|Any CPU - {FBD78AC1-B766-4332-A9B1-C73EE64FD5C6}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {FBD78AC1-B766-4332-A9B1-C73EE64FD5C6}.CI-CSOM2013|Any CPU.Build.0 = Debug|Any CPU - {FBD78AC1-B766-4332-A9B1-C73EE64FD5C6}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU - {FBD78AC1-B766-4332-A9B1-C73EE64FD5C6}.CI-O365|Any CPU.Build.0 = Debug|Any CPU {FBD78AC1-B766-4332-A9B1-C73EE64FD5C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FBD78AC1-B766-4332-A9B1-C73EE64FD5C6}.Debug|Any CPU.Build.0 = Debug|Any CPU {FBD78AC1-B766-4332-A9B1-C73EE64FD5C6}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU {FBD78AC1-B766-4332-A9B1-C73EE64FD5C6}.Debug40|Any CPU.Build.0 = Debug40|Any CPU {FBD78AC1-B766-4332-A9B1-C73EE64FD5C6}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {FBD78AC1-B766-4332-A9B1-C73EE64FD5C6}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {FBD78AC1-B766-4332-A9B1-C73EE64FD5C6}.Release|Any CPU.ActiveCfg = Debug35|Any CPU - {FBD78AC1-B766-4332-A9B1-C73EE64FD5C6}.Release|Any CPU.Build.0 = Debug35|Any CPU - {2DA71A5B-C039-4A2E-9985-91D6501F293C}.CI-CSOM2013|Any CPU.ActiveCfg = CI-CSOM2013|Any CPU - {2DA71A5B-C039-4A2E-9985-91D6501F293C}.CI-CSOM2013|Any CPU.Build.0 = CI-CSOM2013|Any CPU - {2DA71A5B-C039-4A2E-9985-91D6501F293C}.CI-O365|Any CPU.ActiveCfg = CI-O365|Any CPU - {2DA71A5B-C039-4A2E-9985-91D6501F293C}.CI-O365|Any CPU.Build.0 = CI-O365|Any CPU {2DA71A5B-C039-4A2E-9985-91D6501F293C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2DA71A5B-C039-4A2E-9985-91D6501F293C}.Debug|Any CPU.Build.0 = Debug|Any CPU {2DA71A5B-C039-4A2E-9985-91D6501F293C}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU {2DA71A5B-C039-4A2E-9985-91D6501F293C}.Debug40|Any CPU.Build.0 = Debug40|Any CPU {2DA71A5B-C039-4A2E-9985-91D6501F293C}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {2DA71A5B-C039-4A2E-9985-91D6501F293C}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {2DA71A5B-C039-4A2E-9985-91D6501F293C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2DA71A5B-C039-4A2E-9985-91D6501F293C}.Release|Any CPU.Build.0 = Release|Any CPU - {5A1B98BF-4EA4-4DEE-988F-FA62EEFC9EB0}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {5A1B98BF-4EA4-4DEE-988F-FA62EEFC9EB0}.CI-CSOM2013|Any CPU.Build.0 = Debug|Any CPU - {5A1B98BF-4EA4-4DEE-988F-FA62EEFC9EB0}.CI-O365|Any CPU.ActiveCfg = CI-O365|Any CPU - {5A1B98BF-4EA4-4DEE-988F-FA62EEFC9EB0}.CI-O365|Any CPU.Build.0 = CI-O365|Any CPU {5A1B98BF-4EA4-4DEE-988F-FA62EEFC9EB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5A1B98BF-4EA4-4DEE-988F-FA62EEFC9EB0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5A1B98BF-4EA4-4DEE-988F-FA62EEFC9EB0}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU - {5A1B98BF-4EA4-4DEE-988F-FA62EEFC9EB0}.Debug40|Any CPU.Build.0 = Debug40|Any CPU + {5A1B98BF-4EA4-4DEE-988F-FA62EEFC9EB0}.Debug40|Any CPU.ActiveCfg = Debug45|Any CPU + {5A1B98BF-4EA4-4DEE-988F-FA62EEFC9EB0}.Debug40|Any CPU.Build.0 = Debug45|Any CPU {5A1B98BF-4EA4-4DEE-988F-FA62EEFC9EB0}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {5A1B98BF-4EA4-4DEE-988F-FA62EEFC9EB0}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {5A1B98BF-4EA4-4DEE-988F-FA62EEFC9EB0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5A1B98BF-4EA4-4DEE-988F-FA62EEFC9EB0}.Release|Any CPU.Build.0 = Release|Any CPU - {00E1581F-31D9-493E-AD16-C188AE966458}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {00E1581F-31D9-493E-AD16-C188AE966458}.CI-CSOM2013|Any CPU.Build.0 = Debug|Any CPU - {00E1581F-31D9-493E-AD16-C188AE966458}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU - {00E1581F-31D9-493E-AD16-C188AE966458}.CI-O365|Any CPU.Build.0 = Debug|Any CPU {00E1581F-31D9-493E-AD16-C188AE966458}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {00E1581F-31D9-493E-AD16-C188AE966458}.Debug|Any CPU.Build.0 = Debug|Any CPU {00E1581F-31D9-493E-AD16-C188AE966458}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU {00E1581F-31D9-493E-AD16-C188AE966458}.Debug40|Any CPU.Build.0 = Debug40|Any CPU {00E1581F-31D9-493E-AD16-C188AE966458}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {00E1581F-31D9-493E-AD16-C188AE966458}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {00E1581F-31D9-493E-AD16-C188AE966458}.Release|Any CPU.ActiveCfg = Release|Any CPU - {00E1581F-31D9-493E-AD16-C188AE966458}.Release|Any CPU.Build.0 = Release|Any CPU - {7D095A0D-0BDE-446D-8093-13E5685F1D3C}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {7D095A0D-0BDE-446D-8093-13E5685F1D3C}.CI-CSOM2013|Any CPU.Build.0 = Debug|Any CPU - {7D095A0D-0BDE-446D-8093-13E5685F1D3C}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU - {7D095A0D-0BDE-446D-8093-13E5685F1D3C}.CI-O365|Any CPU.Build.0 = Debug|Any CPU {7D095A0D-0BDE-446D-8093-13E5685F1D3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7D095A0D-0BDE-446D-8093-13E5685F1D3C}.Debug|Any CPU.Build.0 = Debug|Any CPU {7D095A0D-0BDE-446D-8093-13E5685F1D3C}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU {7D095A0D-0BDE-446D-8093-13E5685F1D3C}.Debug40|Any CPU.Build.0 = Debug40|Any CPU {7D095A0D-0BDE-446D-8093-13E5685F1D3C}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {7D095A0D-0BDE-446D-8093-13E5685F1D3C}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {7D095A0D-0BDE-446D-8093-13E5685F1D3C}.Release|Any CPU.ActiveCfg = Debug35|Any CPU - {7D095A0D-0BDE-446D-8093-13E5685F1D3C}.Release|Any CPU.Build.0 = Debug35|Any CPU - {D81AE83A-BEEF-4099-B354-0B88D7396B25}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {D81AE83A-BEEF-4099-B354-0B88D7396B25}.CI-CSOM2013|Any CPU.Build.0 = Debug|Any CPU - {D81AE83A-BEEF-4099-B354-0B88D7396B25}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU - {D81AE83A-BEEF-4099-B354-0B88D7396B25}.CI-O365|Any CPU.Build.0 = Debug|Any CPU {D81AE83A-BEEF-4099-B354-0B88D7396B25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D81AE83A-BEEF-4099-B354-0B88D7396B25}.Debug|Any CPU.Build.0 = Debug|Any CPU {D81AE83A-BEEF-4099-B354-0B88D7396B25}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU {D81AE83A-BEEF-4099-B354-0B88D7396B25}.Debug40|Any CPU.Build.0 = Debug40|Any CPU {D81AE83A-BEEF-4099-B354-0B88D7396B25}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {D81AE83A-BEEF-4099-B354-0B88D7396B25}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {D81AE83A-BEEF-4099-B354-0B88D7396B25}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D81AE83A-BEEF-4099-B354-0B88D7396B25}.Release|Any CPU.Build.0 = Release|Any CPU - {33B40E92-C649-41FC-B774-53D259801B3B}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {33B40E92-C649-41FC-B774-53D259801B3B}.CI-CSOM2013|Any CPU.Build.0 = Debug|Any CPU - {33B40E92-C649-41FC-B774-53D259801B3B}.CI-O365|Any CPU.ActiveCfg = CI-O365|Any CPU - {33B40E92-C649-41FC-B774-53D259801B3B}.CI-O365|Any CPU.Build.0 = CI-O365|Any CPU {33B40E92-C649-41FC-B774-53D259801B3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {33B40E92-C649-41FC-B774-53D259801B3B}.Debug|Any CPU.Build.0 = Debug|Any CPU {33B40E92-C649-41FC-B774-53D259801B3B}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU {33B40E92-C649-41FC-B774-53D259801B3B}.Debug40|Any CPU.Build.0 = Debug40|Any CPU {33B40E92-C649-41FC-B774-53D259801B3B}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {33B40E92-C649-41FC-B774-53D259801B3B}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {33B40E92-C649-41FC-B774-53D259801B3B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {33B40E92-C649-41FC-B774-53D259801B3B}.Release|Any CPU.Build.0 = Release|Any CPU - {091C48FB-27E3-4F84-897C-5DE7BB55A2D3}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {091C48FB-27E3-4F84-897C-5DE7BB55A2D3}.CI-CSOM2013|Any CPU.Build.0 = Debug|Any CPU - {091C48FB-27E3-4F84-897C-5DE7BB55A2D3}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU - {091C48FB-27E3-4F84-897C-5DE7BB55A2D3}.CI-O365|Any CPU.Build.0 = Debug|Any CPU {091C48FB-27E3-4F84-897C-5DE7BB55A2D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {091C48FB-27E3-4F84-897C-5DE7BB55A2D3}.Debug|Any CPU.Build.0 = Debug|Any CPU {091C48FB-27E3-4F84-897C-5DE7BB55A2D3}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU {091C48FB-27E3-4F84-897C-5DE7BB55A2D3}.Debug40|Any CPU.Build.0 = Debug40|Any CPU {091C48FB-27E3-4F84-897C-5DE7BB55A2D3}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {091C48FB-27E3-4F84-897C-5DE7BB55A2D3}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {091C48FB-27E3-4F84-897C-5DE7BB55A2D3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {091C48FB-27E3-4F84-897C-5DE7BB55A2D3}.Release|Any CPU.Build.0 = Release|Any CPU - {5793019F-7514-4B1F-B31D-A5E472FD034D}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {5793019F-7514-4B1F-B31D-A5E472FD034D}.CI-CSOM2013|Any CPU.Build.0 = Debug|Any CPU - {5793019F-7514-4B1F-B31D-A5E472FD034D}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU - {5793019F-7514-4B1F-B31D-A5E472FD034D}.CI-O365|Any CPU.Build.0 = Debug|Any CPU {5793019F-7514-4B1F-B31D-A5E472FD034D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5793019F-7514-4B1F-B31D-A5E472FD034D}.Debug|Any CPU.Build.0 = Debug|Any CPU {5793019F-7514-4B1F-B31D-A5E472FD034D}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU {5793019F-7514-4B1F-B31D-A5E472FD034D}.Debug40|Any CPU.Build.0 = Debug40|Any CPU {5793019F-7514-4B1F-B31D-A5E472FD034D}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {5793019F-7514-4B1F-B31D-A5E472FD034D}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {5793019F-7514-4B1F-B31D-A5E472FD034D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5793019F-7514-4B1F-B31D-A5E472FD034D}.Release|Any CPU.Build.0 = Release|Any CPU - {F310878E-9B72-4C3C-AE5D-C60B3515E2FC}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {F310878E-9B72-4C3C-AE5D-C60B3515E2FC}.CI-CSOM2013|Any CPU.Build.0 = Debug|Any CPU - {F310878E-9B72-4C3C-AE5D-C60B3515E2FC}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU - {F310878E-9B72-4C3C-AE5D-C60B3515E2FC}.CI-O365|Any CPU.Build.0 = Debug|Any CPU {F310878E-9B72-4C3C-AE5D-C60B3515E2FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F310878E-9B72-4C3C-AE5D-C60B3515E2FC}.Debug|Any CPU.Build.0 = Debug|Any CPU {F310878E-9B72-4C3C-AE5D-C60B3515E2FC}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU {F310878E-9B72-4C3C-AE5D-C60B3515E2FC}.Debug40|Any CPU.Build.0 = Debug40|Any CPU {F310878E-9B72-4C3C-AE5D-C60B3515E2FC}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {F310878E-9B72-4C3C-AE5D-C60B3515E2FC}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {F310878E-9B72-4C3C-AE5D-C60B3515E2FC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F310878E-9B72-4C3C-AE5D-C60B3515E2FC}.Release|Any CPU.Build.0 = Release|Any CPU - {2A8F08ED-E837-4E91-8E49-B5F30CF9EEF3}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {2A8F08ED-E837-4E91-8E49-B5F30CF9EEF3}.CI-CSOM2013|Any CPU.Build.0 = Debug|Any CPU - {2A8F08ED-E837-4E91-8E49-B5F30CF9EEF3}.CI-O365|Any CPU.ActiveCfg = CI-O365|Any CPU - {2A8F08ED-E837-4E91-8E49-B5F30CF9EEF3}.CI-O365|Any CPU.Build.0 = CI-O365|Any CPU {2A8F08ED-E837-4E91-8E49-B5F30CF9EEF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2A8F08ED-E837-4E91-8E49-B5F30CF9EEF3}.Debug|Any CPU.Build.0 = Debug|Any CPU {2A8F08ED-E837-4E91-8E49-B5F30CF9EEF3}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU {2A8F08ED-E837-4E91-8E49-B5F30CF9EEF3}.Debug40|Any CPU.Build.0 = Debug40|Any CPU {2A8F08ED-E837-4E91-8E49-B5F30CF9EEF3}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {2A8F08ED-E837-4E91-8E49-B5F30CF9EEF3}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {2A8F08ED-E837-4E91-8E49-B5F30CF9EEF3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2A8F08ED-E837-4E91-8E49-B5F30CF9EEF3}.Release|Any CPU.Build.0 = Release|Any CPU - {8B199151-24BC-4C32-B69F-7371B37F33D4}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {8B199151-24BC-4C32-B69F-7371B37F33D4}.CI-CSOM2013|Any CPU.Build.0 = Debug|Any CPU - {8B199151-24BC-4C32-B69F-7371B37F33D4}.CI-O365|Any CPU.ActiveCfg = CI-O365|Any CPU - {8B199151-24BC-4C32-B69F-7371B37F33D4}.CI-O365|Any CPU.Build.0 = CI-O365|Any CPU {8B199151-24BC-4C32-B69F-7371B37F33D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8B199151-24BC-4C32-B69F-7371B37F33D4}.Debug|Any CPU.Build.0 = Debug|Any CPU {8B199151-24BC-4C32-B69F-7371B37F33D4}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU {8B199151-24BC-4C32-B69F-7371B37F33D4}.Debug40|Any CPU.Build.0 = Debug40|Any CPU {8B199151-24BC-4C32-B69F-7371B37F33D4}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {8B199151-24BC-4C32-B69F-7371B37F33D4}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {8B199151-24BC-4C32-B69F-7371B37F33D4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8B199151-24BC-4C32-B69F-7371B37F33D4}.Release|Any CPU.Build.0 = Release|Any CPU - {04EF5903-B379-4404-8DBC-B21ABE0D1099}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {04EF5903-B379-4404-8DBC-B21ABE0D1099}.CI-CSOM2013|Any CPU.Build.0 = Debug|Any CPU - {04EF5903-B379-4404-8DBC-B21ABE0D1099}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU - {04EF5903-B379-4404-8DBC-B21ABE0D1099}.CI-O365|Any CPU.Build.0 = Debug|Any CPU {04EF5903-B379-4404-8DBC-B21ABE0D1099}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {04EF5903-B379-4404-8DBC-B21ABE0D1099}.Debug|Any CPU.Build.0 = Debug|Any CPU {04EF5903-B379-4404-8DBC-B21ABE0D1099}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU {04EF5903-B379-4404-8DBC-B21ABE0D1099}.Debug40|Any CPU.Build.0 = Debug40|Any CPU {04EF5903-B379-4404-8DBC-B21ABE0D1099}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {04EF5903-B379-4404-8DBC-B21ABE0D1099}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {04EF5903-B379-4404-8DBC-B21ABE0D1099}.Release|Any CPU.ActiveCfg = Release|Any CPU - {04EF5903-B379-4404-8DBC-B21ABE0D1099}.Release|Any CPU.Build.0 = Release|Any CPU - {E9274D1F-BF08-44CB-9162-35110379D5C0}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {E9274D1F-BF08-44CB-9162-35110379D5C0}.CI-CSOM2013|Any CPU.Build.0 = Debug|Any CPU - {E9274D1F-BF08-44CB-9162-35110379D5C0}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU - {E9274D1F-BF08-44CB-9162-35110379D5C0}.CI-O365|Any CPU.Build.0 = Debug|Any CPU {E9274D1F-BF08-44CB-9162-35110379D5C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E9274D1F-BF08-44CB-9162-35110379D5C0}.Debug|Any CPU.Build.0 = Debug|Any CPU {E9274D1F-BF08-44CB-9162-35110379D5C0}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU {E9274D1F-BF08-44CB-9162-35110379D5C0}.Debug40|Any CPU.Build.0 = Debug40|Any CPU {E9274D1F-BF08-44CB-9162-35110379D5C0}.Debug45|Any CPU.ActiveCfg = Debug45|Any CPU {E9274D1F-BF08-44CB-9162-35110379D5C0}.Debug45|Any CPU.Build.0 = Debug45|Any CPU - {E9274D1F-BF08-44CB-9162-35110379D5C0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E9274D1F-BF08-44CB-9162-35110379D5C0}.Release|Any CPU.Build.0 = Release|Any CPU - {7B84193A-251E-47F1-BDD0-EDD85918D307}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {7B84193A-251E-47F1-BDD0-EDD85918D307}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU {7B84193A-251E-47F1-BDD0-EDD85918D307}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7B84193A-251E-47F1-BDD0-EDD85918D307}.Debug40|Any CPU.ActiveCfg = Debug|Any CPU {7B84193A-251E-47F1-BDD0-EDD85918D307}.Debug40|Any CPU.Build.0 = Debug|Any CPU {7B84193A-251E-47F1-BDD0-EDD85918D307}.Debug45|Any CPU.ActiveCfg = Debug|Any CPU {7B84193A-251E-47F1-BDD0-EDD85918D307}.Debug45|Any CPU.Build.0 = Debug|Any CPU - {7B84193A-251E-47F1-BDD0-EDD85918D307}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7B84193A-251E-47F1-BDD0-EDD85918D307}.Release|Any CPU.Build.0 = Release|Any CPU - {B556A178-DA0A-4DA0-AF92-2D2504FBCDA9}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {B556A178-DA0A-4DA0-AF92-2D2504FBCDA9}.CI-CSOM2013|Any CPU.Build.0 = Debug|Any CPU - {B556A178-DA0A-4DA0-AF92-2D2504FBCDA9}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU - {B556A178-DA0A-4DA0-AF92-2D2504FBCDA9}.CI-O365|Any CPU.Build.0 = Debug|Any CPU {B556A178-DA0A-4DA0-AF92-2D2504FBCDA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B556A178-DA0A-4DA0-AF92-2D2504FBCDA9}.Debug|Any CPU.Build.0 = Debug|Any CPU {B556A178-DA0A-4DA0-AF92-2D2504FBCDA9}.Debug40|Any CPU.ActiveCfg = Debug|Any CPU {B556A178-DA0A-4DA0-AF92-2D2504FBCDA9}.Debug40|Any CPU.Build.0 = Debug|Any CPU {B556A178-DA0A-4DA0-AF92-2D2504FBCDA9}.Debug45|Any CPU.ActiveCfg = Debug|Any CPU {B556A178-DA0A-4DA0-AF92-2D2504FBCDA9}.Debug45|Any CPU.Build.0 = Debug|Any CPU - {B556A178-DA0A-4DA0-AF92-2D2504FBCDA9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B556A178-DA0A-4DA0-AF92-2D2504FBCDA9}.Release|Any CPU.Build.0 = Release|Any CPU - {A88390A8-20F2-4247-A9C3-28480FEAEFA6}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {A88390A8-20F2-4247-A9C3-28480FEAEFA6}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU {A88390A8-20F2-4247-A9C3-28480FEAEFA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A88390A8-20F2-4247-A9C3-28480FEAEFA6}.Debug40|Any CPU.ActiveCfg = Debug|Any CPU {A88390A8-20F2-4247-A9C3-28480FEAEFA6}.Debug40|Any CPU.Build.0 = Debug|Any CPU @@ -377,11 +259,6 @@ Global {A88390A8-20F2-4247-A9C3-28480FEAEFA6}.Debug45|Any CPU.ActiveCfg = Debug|Any CPU {A88390A8-20F2-4247-A9C3-28480FEAEFA6}.Debug45|Any CPU.Build.0 = Debug|Any CPU {A88390A8-20F2-4247-A9C3-28480FEAEFA6}.Debug45|Any CPU.Deploy.0 = Debug|Any CPU - {A88390A8-20F2-4247-A9C3-28480FEAEFA6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A88390A8-20F2-4247-A9C3-28480FEAEFA6}.Release|Any CPU.Build.0 = Release|Any CPU - {A88390A8-20F2-4247-A9C3-28480FEAEFA6}.Release|Any CPU.Deploy.0 = Release|Any CPU - {16A7F927-A570-4EB0-90E6-887E676AF42B}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {16A7F927-A570-4EB0-90E6-887E676AF42B}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU {16A7F927-A570-4EB0-90E6-887E676AF42B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {16A7F927-A570-4EB0-90E6-887E676AF42B}.Debug40|Any CPU.ActiveCfg = Debug|Any CPU {16A7F927-A570-4EB0-90E6-887E676AF42B}.Debug40|Any CPU.Build.0 = Debug|Any CPU @@ -389,20 +266,11 @@ Global {16A7F927-A570-4EB0-90E6-887E676AF42B}.Debug45|Any CPU.ActiveCfg = Debug|Any CPU {16A7F927-A570-4EB0-90E6-887E676AF42B}.Debug45|Any CPU.Build.0 = Debug|Any CPU {16A7F927-A570-4EB0-90E6-887E676AF42B}.Debug45|Any CPU.Deploy.0 = Debug|Any CPU - {16A7F927-A570-4EB0-90E6-887E676AF42B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {16A7F927-A570-4EB0-90E6-887E676AF42B}.Release|Any CPU.Build.0 = Release|Any CPU - {16A7F927-A570-4EB0-90E6-887E676AF42B}.Release|Any CPU.Deploy.0 = Release|Any CPU - {16E57ADA-0D73-429E-96F7-87EAA03128D9}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {16E57ADA-0D73-429E-96F7-87EAA03128D9}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU {16E57ADA-0D73-429E-96F7-87EAA03128D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {16E57ADA-0D73-429E-96F7-87EAA03128D9}.Debug40|Any CPU.ActiveCfg = Debug|Any CPU {16E57ADA-0D73-429E-96F7-87EAA03128D9}.Debug40|Any CPU.Build.0 = Debug|Any CPU {16E57ADA-0D73-429E-96F7-87EAA03128D9}.Debug45|Any CPU.ActiveCfg = Debug|Any CPU {16E57ADA-0D73-429E-96F7-87EAA03128D9}.Debug45|Any CPU.Build.0 = Debug|Any CPU - {16E57ADA-0D73-429E-96F7-87EAA03128D9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {16E57ADA-0D73-429E-96F7-87EAA03128D9}.Release|Any CPU.Build.0 = Release|Any CPU - {2A290D6E-6AF3-4D17-975D-3C393700A0B1}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {2A290D6E-6AF3-4D17-975D-3C393700A0B1}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU {2A290D6E-6AF3-4D17-975D-3C393700A0B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2A290D6E-6AF3-4D17-975D-3C393700A0B1}.Debug40|Any CPU.ActiveCfg = Debug|Any CPU {2A290D6E-6AF3-4D17-975D-3C393700A0B1}.Debug40|Any CPU.Build.0 = Debug|Any CPU @@ -410,44 +278,40 @@ Global {2A290D6E-6AF3-4D17-975D-3C393700A0B1}.Debug45|Any CPU.ActiveCfg = Debug|Any CPU {2A290D6E-6AF3-4D17-975D-3C393700A0B1}.Debug45|Any CPU.Build.0 = Debug|Any CPU {2A290D6E-6AF3-4D17-975D-3C393700A0B1}.Debug45|Any CPU.Deploy.0 = Debug|Any CPU - {2A290D6E-6AF3-4D17-975D-3C393700A0B1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2A290D6E-6AF3-4D17-975D-3C393700A0B1}.Release|Any CPU.Build.0 = Release|Any CPU - {2A290D6E-6AF3-4D17-975D-3C393700A0B1}.Release|Any CPU.Deploy.0 = Release|Any CPU - {0DE538C9-1723-46B1-90F8-5DC67C56D7DD}.CI-CSOM2013|Any CPU.ActiveCfg = Debug|Any CPU - {0DE538C9-1723-46B1-90F8-5DC67C56D7DD}.CI-CSOM2013|Any CPU.Build.0 = Debug|Any CPU - {0DE538C9-1723-46B1-90F8-5DC67C56D7DD}.CI-O365|Any CPU.ActiveCfg = Debug|Any CPU - {0DE538C9-1723-46B1-90F8-5DC67C56D7DD}.CI-O365|Any CPU.Build.0 = Debug|Any CPU {0DE538C9-1723-46B1-90F8-5DC67C56D7DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0DE538C9-1723-46B1-90F8-5DC67C56D7DD}.Debug|Any CPU.Build.0 = Debug|Any CPU {0DE538C9-1723-46B1-90F8-5DC67C56D7DD}.Debug40|Any CPU.ActiveCfg = Debug|Any CPU {0DE538C9-1723-46B1-90F8-5DC67C56D7DD}.Debug40|Any CPU.Build.0 = Debug|Any CPU {0DE538C9-1723-46B1-90F8-5DC67C56D7DD}.Debug45|Any CPU.ActiveCfg = Debug|Any CPU {0DE538C9-1723-46B1-90F8-5DC67C56D7DD}.Debug45|Any CPU.Build.0 = Debug|Any CPU - {0DE538C9-1723-46B1-90F8-5DC67C56D7DD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0DE538C9-1723-46B1-90F8-5DC67C56D7DD}.Release|Any CPU.Build.0 = Release|Any CPU - {B30F6CA8-3E96-4734-B6B1-A61F201099E4}.CI-CSOM2013|Any CPU.ActiveCfg = Release|Any CPU - {B30F6CA8-3E96-4734-B6B1-A61F201099E4}.CI-CSOM2013|Any CPU.Build.0 = Release|Any CPU - {B30F6CA8-3E96-4734-B6B1-A61F201099E4}.CI-O365|Any CPU.ActiveCfg = Release|Any CPU - {B30F6CA8-3E96-4734-B6B1-A61F201099E4}.CI-O365|Any CPU.Build.0 = Release|Any CPU {B30F6CA8-3E96-4734-B6B1-A61F201099E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B30F6CA8-3E96-4734-B6B1-A61F201099E4}.Debug|Any CPU.Build.0 = Debug|Any CPU {B30F6CA8-3E96-4734-B6B1-A61F201099E4}.Debug40|Any CPU.ActiveCfg = Debug|Any CPU {B30F6CA8-3E96-4734-B6B1-A61F201099E4}.Debug40|Any CPU.Build.0 = Debug|Any CPU {B30F6CA8-3E96-4734-B6B1-A61F201099E4}.Debug45|Any CPU.ActiveCfg = Debug|Any CPU {B30F6CA8-3E96-4734-B6B1-A61F201099E4}.Debug45|Any CPU.Build.0 = Debug|Any CPU - {B30F6CA8-3E96-4734-B6B1-A61F201099E4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B30F6CA8-3E96-4734-B6B1-A61F201099E4}.Release|Any CPU.Build.0 = Release|Any CPU - {B9AD05BB-B576-46B8-89A0-FBC70C438B64}.CI-CSOM2013|Any CPU.ActiveCfg = Release|Any CPU - {B9AD05BB-B576-46B8-89A0-FBC70C438B64}.CI-CSOM2013|Any CPU.Build.0 = Release|Any CPU - {B9AD05BB-B576-46B8-89A0-FBC70C438B64}.CI-O365|Any CPU.ActiveCfg = Release|Any CPU - {B9AD05BB-B576-46B8-89A0-FBC70C438B64}.CI-O365|Any CPU.Build.0 = Release|Any CPU {B9AD05BB-B576-46B8-89A0-FBC70C438B64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B9AD05BB-B576-46B8-89A0-FBC70C438B64}.Debug40|Any CPU.ActiveCfg = Debug|Any CPU {B9AD05BB-B576-46B8-89A0-FBC70C438B64}.Debug40|Any CPU.Build.0 = Debug|Any CPU {B9AD05BB-B576-46B8-89A0-FBC70C438B64}.Debug45|Any CPU.ActiveCfg = Debug|Any CPU {B9AD05BB-B576-46B8-89A0-FBC70C438B64}.Debug45|Any CPU.Build.0 = Debug|Any CPU - {B9AD05BB-B576-46B8-89A0-FBC70C438B64}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B9AD05BB-B576-46B8-89A0-FBC70C438B64}.Release|Any CPU.Build.0 = Release|Any CPU + {D19B0907-CED5-416A-9D45-0F112990C234}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D19B0907-CED5-416A-9D45-0F112990C234}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D19B0907-CED5-416A-9D45-0F112990C234}.Debug40|Any CPU.ActiveCfg = Debug|Any CPU + {D19B0907-CED5-416A-9D45-0F112990C234}.Debug40|Any CPU.Build.0 = Debug|Any CPU + {D19B0907-CED5-416A-9D45-0F112990C234}.Debug45|Any CPU.ActiveCfg = Debug|Any CPU + {D19B0907-CED5-416A-9D45-0F112990C234}.Debug45|Any CPU.Build.0 = Debug|Any CPU + {588FC30F-1C85-410E-AB20-C9741DB28857}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {588FC30F-1C85-410E-AB20-C9741DB28857}.Debug|Any CPU.Build.0 = Debug|Any CPU + {588FC30F-1C85-410E-AB20-C9741DB28857}.Debug40|Any CPU.ActiveCfg = Debug|Any CPU + {588FC30F-1C85-410E-AB20-C9741DB28857}.Debug40|Any CPU.Build.0 = Debug|Any CPU + {588FC30F-1C85-410E-AB20-C9741DB28857}.Debug45|Any CPU.ActiveCfg = Debug|Any CPU + {588FC30F-1C85-410E-AB20-C9741DB28857}.Debug45|Any CPU.Build.0 = Debug|Any CPU + {788D7D6E-5347-4D09-BFF8-E83AD7CA1FD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {788D7D6E-5347-4D09-BFF8-E83AD7CA1FD3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {788D7D6E-5347-4D09-BFF8-E83AD7CA1FD3}.Debug40|Any CPU.ActiveCfg = Debug|Any CPU + {788D7D6E-5347-4D09-BFF8-E83AD7CA1FD3}.Debug40|Any CPU.Build.0 = Debug|Any CPU + {788D7D6E-5347-4D09-BFF8-E83AD7CA1FD3}.Debug45|Any CPU.ActiveCfg = Debug|Any CPU + {788D7D6E-5347-4D09-BFF8-E83AD7CA1FD3}.Debug45|Any CPU.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -490,5 +354,8 @@ Global {0DE538C9-1723-46B1-90F8-5DC67C56D7DD} = {AA39B47D-287D-4DAC-A1B6-CBEE826B0D83} {B30F6CA8-3E96-4734-B6B1-A61F201099E4} = {7DCBDB97-13FC-4A07-B49C-2300D2FBCF8D} {B9AD05BB-B576-46B8-89A0-FBC70C438B64} = {EE9BD842-2CA9-45B2-AB7C-A8EB0353AAB7} + {D19B0907-CED5-416A-9D45-0F112990C234} = {543E02CC-AA4A-4B1F-ABBD-2C88CFAA463C} + {588FC30F-1C85-410E-AB20-C9741DB28857} = {543E02CC-AA4A-4B1F-ABBD-2C88CFAA463C} + {788D7D6E-5347-4D09-BFF8-E83AD7CA1FD3} = {543E02CC-AA4A-4B1F-ABBD-2C88CFAA463C} EndGlobalSection EndGlobal diff --git a/SPMeta2/Build/Build.csproj b/SPMeta2/Build/Build.csproj index 3832822e4..35cf0f3e5 100644 --- a/SPMeta2/Build/Build.csproj +++ b/SPMeta2/Build/Build.csproj @@ -42,8 +42,20 @@ - + + + + + + + + + + + + + + bin\Debug35-$(spRuntime)\ v3.5 true @@ -41,15 +30,7 @@ false bin\Debug35-$(spRuntime)\SPMeta2.CSOM.Standard.XML - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - + bin\Debug40-$(spRuntime)\ v4.0 true @@ -60,8 +41,9 @@ 4 false bin\Debug40-$(spRuntime)\SPMeta2.CSOM.Standard.XML + - + bin\Debug45-$(spRuntime)\ v4.5 true @@ -73,59 +55,32 @@ false bin\Debug45-$(spRuntime)\SPMeta2.CSOM.Standard.XML - - true - - - SPMeta2.snk - - - bin\Debug40-$(spRuntime)\ - - + + + + bin\Debug\ + v4.5 true - bin\Debug45-$(spRuntime)\ - DEBUG;TRACE - bin\Debug45-$(spRuntime)\SPMeta2.CSOM.Standard.XML full - AnyCPU + false + TRACE;DEBUG prompt - MinimumRecommendedRules.ruleset - - - true - bin\CI-O365\ - DEBUG;TRACE + 4 + false bin\Debug\SPMeta2.CSOM.Standard.XML - true - 1591 - full - AnyCPU - prompt - MinimumRecommendedRules.ruleset - - true - bin\CI-CSOM2013\ - DEBUG;TRACE - bin\Debug\SPMeta2.CSOM.Standard.XML - true - 1591 - full - AnyCPU - prompt - MinimumRecommendedRules.ruleset + + true + + + SPMeta2.snk True ..\SPMeta2.Dependencies\SharePoint\SP2010 - 14.0.4762.1000\CSOM\Microsoft.SharePoint.Client.dll False - - - False - ..\SPMeta2.Dependencies\SharePoint\SP2013 - 15.0.4569.1000\CSOM\Microsoft.SharePoint.Client.DocumentManagement.dll - + True ..\SPMeta2.Dependencies\SharePoint\SP2010 - 14.0.4762.1000\CSOM\Microsoft.SharePoint.Client.Runtime.dll @@ -160,6 +115,11 @@ ..\SPMeta2.Dependencies\SharePoint\SP2013 - 15.0.4569.1000\CSOM\Microsoft.SharePoint.Client.WorkflowServices.dll False + + True + ..\SPMeta2.Dependencies\SharePoint\SP2013 - 15.0.4569.1000\CSOM\Microsoft.SharePoint.Client.DocumentManagement.dll + False + True ..\SPMeta2.Dependencies\SharePoint\SP2016 - 16.0.4306.1001\CSOM\Microsoft.SharePoint.Client.dll @@ -189,6 +149,11 @@ True ..\SPMeta2.Dependencies\SharePoint\SP2016 - 16.0.4306.1001\CSOM\Microsoft.SharePoint.Client.WorkflowServices.dll False + + + True + ..\SPMeta2.Dependencies\SharePoint\SP2016 - 16.0.4306.1001\CSOM\Microsoft.SharePoint.Client.DocumentManagement.dll + False True @@ -222,6 +187,10 @@ True ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.Taxonomy.dll + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.DocumentManagement.dll + True ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET40\Microsoft.SharePoint.Client.WorkflowServices.dll @@ -254,6 +223,10 @@ True ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET40\Microsoft.SharePoint.Client.Taxonomy.dll + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET40\Microsoft.SharePoint.Client.DocumentManagement.dll + diff --git a/SPMeta2/SPMeta2.CSOM/ModelHandlers/CSOMModelHandlerBase.cs b/SPMeta2/SPMeta2.CSOM/ModelHandlers/CSOMModelHandlerBase.cs index 5d1e7a536..fc0635dd1 100644 --- a/SPMeta2/SPMeta2.CSOM/ModelHandlers/CSOMModelHandlerBase.cs +++ b/SPMeta2/SPMeta2.CSOM/ModelHandlers/CSOMModelHandlerBase.cs @@ -1,117 +1,122 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Microsoft.SharePoint.Client; - -using SPMeta2.CSOM.Services; -using SPMeta2.CSOM.Extensions; -using SPMeta2.Definitions; -using SPMeta2.Exceptions; -using SPMeta2.ModelHandlers; -using SPMeta2.Services; -using SPMeta2.Utils; - -namespace SPMeta2.CSOM.ModelHandlers -{ - public abstract class CSOMModelHandlerBase : ModelHandlerBase - { - #region constructors - - public CSOMModelHandlerBase() - { - TokenReplacementService = ServiceContainer.Instance.GetService(); - LocalizationService = ServiceContainer.Instance.GetService(); - - // TODO, move to ServiceContainer - ContentTypeLookupService = new CSOMContentTypeLookupService(); - FieldLookupService = new CSOMFieldLookupService(); - } - - #endregion - - #region properties - - public CSOMFieldLookupService FieldLookupService { get; set; } - public CSOMContentTypeLookupService ContentTypeLookupService { get; set; } - public TokenReplacementServiceBase TokenReplacementService { get; set; } - public LocalizationServiceBase LocalizationService { get; set; } - - #endregion - - #region utils - - protected virtual object GetPropertyValue(object obj, string propName) - { - return ReflectionUtils.GetPropertyValue(obj, propName); - } - - #endregion - - #region localization - - protected virtual void ProcessGenericLocalization(ClientObject obj, Dictionary> localizations) - { - var targetProps = localizations.Keys.ToList(); - var isSupportedRuntime = ReflectionUtils.HasProperties(obj, targetProps); - - if (!isSupportedRuntime) - { - TraceService.Critical((int)LogEventId.ModelProvisionCoreCall, - string.Format("CSOM runtime doesn't have [{0}] methods support. Update CSOM runtime to a new version. Provision is skipped", - string.Join(", ", targetProps.ToArray()))); - - return; - } - - var needsUpdate = false; - - foreach (var key in localizations.Keys) - { - var propName = key; - var localization = localizations[key]; - - if (localization.Any()) - { - var userResource = GetPropertyValue(obj, propName); - - foreach (var locValue in localization) - LocalizationService.ProcessUserResource(obj, userResource, locValue); - - needsUpdate = true; - } - } - - if (needsUpdate) - { - var updateMethod = ReflectionUtils.GetMethod(obj, "Update"); - - if (updateMethod != null) - { - if (obj is ContentType) - { - updateMethod.Invoke(obj, new object[] { true }); - } - else if (obj is Field) - { - updateMethod = ReflectionUtils.GetMethod(obj, "UpdateAndPushChanges"); - updateMethod.Invoke(obj, new object[] { true }); - } - else - { - updateMethod.Invoke(obj, null); - } - - obj.Context.ExecuteQueryWithTrace(); - } - else - { - throw new SPMeta2Exception(String.Format("Can't find Update() methods on client object of type:[{0}]", obj.GetType())); - } - } - } - - #endregion - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Microsoft.SharePoint.Client; + +using SPMeta2.CSOM.Services; +using SPMeta2.CSOM.Extensions; +using SPMeta2.Definitions; +using SPMeta2.Exceptions; +using SPMeta2.ModelHandlers; +using SPMeta2.Services; +using SPMeta2.Utils; +using SPMeta2.CSOM.Services.Impl; + +namespace SPMeta2.CSOM.ModelHandlers +{ + public abstract class CSOMModelHandlerBase : ModelHandlerBase + { + #region constructors + + public CSOMModelHandlerBase() + { + TokenReplacementService = ServiceContainer.Instance.GetService(); + LocalizationService = ServiceContainer.Instance.GetService(); + + ClientRuntimeQueryService = ServiceContainer.Instance.GetService() ?? new DefaultClientRuntimeQueryService(); + + // TODO, move to ServiceContainer + ContentTypeLookupService = new CSOMContentTypeLookupService(); + FieldLookupService = new CSOMFieldLookupService(); + } + + #endregion + + #region properties + + public CSOMFieldLookupService FieldLookupService { get; set; } + public CSOMContentTypeLookupService ContentTypeLookupService { get; set; } + public TokenReplacementServiceBase TokenReplacementService { get; set; } + public LocalizationServiceBase LocalizationService { get; set; } + + public ClientRuntimeQueryServiceBase ClientRuntimeQueryService { get; set; } + + #endregion + + #region utils + + protected virtual object GetPropertyValue(object obj, string propName) + { + return ReflectionUtils.GetPropertyValue(obj, propName); + } + + #endregion + + #region localization + + protected virtual void ProcessGenericLocalization(ClientObject obj, Dictionary> localizations) + { + var targetProps = localizations.Keys.ToList(); + var isSupportedRuntime = ReflectionUtils.HasProperties(obj, targetProps); + + if (!isSupportedRuntime) + { + TraceService.Critical((int)LogEventId.ModelProvisionCoreCall, + string.Format("CSOM runtime doesn't have [{0}] methods support. Update CSOM runtime to a new version. Provision is skipped", + string.Join(", ", targetProps.ToArray()))); + + return; + } + + var needsUpdate = false; + + foreach (var key in localizations.Keys) + { + var propName = key; + var localization = localizations[key]; + + if (localization.Any()) + { + var userResource = GetPropertyValue(obj, propName); + + foreach (var locValue in localization) + LocalizationService.ProcessUserResource(obj, userResource, locValue); + + needsUpdate = true; + } + } + + if (needsUpdate) + { + var updateMethod = ReflectionUtils.GetMethod(obj, "Update"); + + if (updateMethod != null) + { + if (obj is ContentType) + { + updateMethod.Invoke(obj, new object[] { true }); + } + else if (obj is Field) + { + updateMethod = ReflectionUtils.GetMethod(obj, "UpdateAndPushChanges"); + updateMethod.Invoke(obj, new object[] { true }); + } + else + { + updateMethod.Invoke(obj, null); + } + + obj.Context.ExecuteQueryWithTrace(); + } + else + { + throw new SPMeta2Exception(String.Format("Can't find Update() methods on client object of type:[{0}]", obj.GetType())); + } + } + } + + #endregion + } +} diff --git a/SPMeta2/SPMeta2.CSOM/ModelHandlers/ContentTypeFieldLinkModelHandler.cs b/SPMeta2/SPMeta2.CSOM/ModelHandlers/ContentTypeFieldLinkModelHandler.cs index a51ae4f2c..8a64490d6 100644 --- a/SPMeta2/SPMeta2.CSOM/ModelHandlers/ContentTypeFieldLinkModelHandler.cs +++ b/SPMeta2/SPMeta2.CSOM/ModelHandlers/ContentTypeFieldLinkModelHandler.cs @@ -179,12 +179,7 @@ public override void DeployModel(object modelHost, DefinitionBase model) if (ReflectionUtils.HasProperty(fieldLink, "DisplayName")) { if (!string.IsNullOrEmpty(contentTypeFieldLinkModel.DisplayName)) - { - context.AddQuery(new ClientActionInvokeMethod(fieldLink, "DisplayName", new object[] - { - contentTypeFieldLinkModel.DisplayName - })); - } + ClientRuntimeQueryService.SetProperty(fieldLink, "DisplayName", contentTypeFieldLinkModel.DisplayName); } else { diff --git a/SPMeta2/SPMeta2.CSOM/ModelHandlers/FieldModelHandler.cs b/SPMeta2/SPMeta2.CSOM/ModelHandlers/FieldModelHandler.cs index f68242070..03bc1550d 100644 --- a/SPMeta2/SPMeta2.CSOM/ModelHandlers/FieldModelHandler.cs +++ b/SPMeta2/SPMeta2.CSOM/ModelHandlers/FieldModelHandler.cs @@ -312,7 +312,11 @@ protected virtual void ProcessFieldProperties(Field field, FieldDefinition defin field.Indexed = definition.Indexed; } - field.JSLink = definition.JSLink; + // setting up JS link seems to crash fields provision in some cases + // Issue deploying fields to Site attached to Office 365 Group #945 + // https://github.com/SubPointSolutions/spmeta2/issues/945 + if (!string.IsNullOrEmpty(definition.JSLink)) + field.JSLink = definition.JSLink; #endif #if !NET35 @@ -451,8 +455,10 @@ protected virtual void ProcessSPFieldXElement(XElement fieldTemplate, FieldDefin fieldTemplate.SetAttribute(BuiltInFieldAttributes.StaticName, fieldModel.InternalName); // additions +#if !NET35 if (!String.IsNullOrEmpty(fieldModel.JSLink)) fieldTemplate.SetAttribute(BuiltInFieldAttributes.JSLink, fieldModel.JSLink); +#endif if (!string.IsNullOrEmpty(fieldModel.DefaultValue)) fieldTemplate.SetSubNode("Default", fieldModel.DefaultValue); diff --git a/SPMeta2/SPMeta2.CSOM/ModelHandlers/ListModelHandler.cs b/SPMeta2/SPMeta2.CSOM/ModelHandlers/ListModelHandler.cs index 4a1a6fd52..455980e34 100644 --- a/SPMeta2/SPMeta2.CSOM/ModelHandlers/ListModelHandler.cs +++ b/SPMeta2/SPMeta2.CSOM/ModelHandlers/ListModelHandler.cs @@ -468,7 +468,7 @@ private void MapListProperties(object modelHost, List list, ListDefinition defin { if (ReflectionUtils.HasProperty(list, "MajorVersionLimit")) { - context.AddQuery(new ClientActionSetProperty(list, "MajorVersionLimit", definition.MajorVersionLimit.Value)); + ClientRuntimeQueryService.SetProperty(list, "MajorVersionLimit", definition.MajorVersionLimit.Value); } else { @@ -483,7 +483,7 @@ private void MapListProperties(object modelHost, List list, ListDefinition defin { if (ReflectionUtils.HasProperty(list, "MajorWithMinorVersionsLimit")) { - context.AddQuery(new ClientActionSetProperty(list, "MajorWithMinorVersionsLimit", definition.MajorWithMinorVersionsLimit.Value)); + ClientRuntimeQueryService.SetProperty(list, "MajorWithMinorVersionsLimit", definition.MajorWithMinorVersionsLimit.Value); } else { @@ -497,12 +497,7 @@ private void MapListProperties(object modelHost, List list, ListDefinition defin if (definition.ReadSecurity.HasValue) { if (ReflectionUtils.HasProperty(list, "ReadSecurity")) - { - context.AddQuery(new ClientActionInvokeMethod(list, "ReadSecurity", new object[] - { - definition.ReadSecurity.Value - })); - } + ClientRuntimeQueryService.SetProperty(list, "ReadSecurity", definition.ReadSecurity.Value); else { TraceService.Critical((int)LogEventId.ModelProvisionCoreCall, @@ -513,12 +508,7 @@ private void MapListProperties(object modelHost, List list, ListDefinition defin if (definition.WriteSecurity.HasValue) { if (ReflectionUtils.HasProperty(list, "WriteSecurity")) - { - context.AddQuery(new ClientActionInvokeMethod(list, "WriteSecurity", new object[] - { - definition.WriteSecurity.Value - })); - } + ClientRuntimeQueryService.SetProperty(list, "WriteSecurity", definition.WriteSecurity.Value); else { TraceService.Critical((int)LogEventId.ModelProvisionCoreCall, diff --git a/SPMeta2/SPMeta2.CSOM/ModelHandlers/ListViewModelHandler.cs b/SPMeta2/SPMeta2.CSOM/ModelHandlers/ListViewModelHandler.cs index dd003f5c4..57199a4a8 100644 --- a/SPMeta2/SPMeta2.CSOM/ModelHandlers/ListViewModelHandler.cs +++ b/SPMeta2/SPMeta2.CSOM/ModelHandlers/ListViewModelHandler.cs @@ -195,6 +195,27 @@ public override void DeployModel(object modelHost, DefinitionBase model) string.IsNullOrEmpty(listViewModel.Type) ? BuiltInViewType.Html : listViewModel.Type); } + // nasty hack + + // The provision of calendars is not working properly #935 + // https://github.com/SubPointSolutions/spmeta2/issues/935 + if (listViewModel.Types.Count() > 0) + { + ViewType? finalType = null; + + foreach (var type in listViewModel.Types) + { + var tmpViewType = (ViewType)Enum.Parse(typeof(ViewType), type); + + if (finalType == null) + finalType = tmpViewType; + else + finalType = finalType | tmpViewType; + } + + newView.ViewTypeKind = finalType.Value; + } + currentView = list.Views.Add(newView); MapListViewProperties(list, currentView, listViewModel); @@ -278,10 +299,10 @@ public virtual void MapListViewProperties(List list, View listView, ListViewDefi // There is no value in setting Aggregations if AggregationsStatus is not to "On" if (!string.IsNullOrEmpty(definition.AggregationsStatus) && definition.AggregationsStatus == "On") { - listView.AggregationsStatus = definition.AggregationsStatus; - if (!string.IsNullOrEmpty(definition.Aggregations)) listView.Aggregations = definition.Aggregations; + + listView.AggregationsStatus = definition.AggregationsStatus; } listView.Hidden = definition.Hidden; diff --git a/SPMeta2/SPMeta2.CSOM/ModelHandlers/RegionalSettingsModelHandler.cs b/SPMeta2/SPMeta2.CSOM/ModelHandlers/RegionalSettingsModelHandler.cs index fc105d0a6..034f4ba1f 100644 --- a/SPMeta2/SPMeta2.CSOM/ModelHandlers/RegionalSettingsModelHandler.cs +++ b/SPMeta2/SPMeta2.CSOM/ModelHandlers/RegionalSettingsModelHandler.cs @@ -76,7 +76,7 @@ private void DeployRegionalSettings(object modelHost, Web web, RegionalSettingsD if (shouldUpdate) { - context.AddQuery(new ClientActionInvokeMethod(settings, "Update", null)); + ClientRuntimeQueryService.InvokeMethod(settings, "Update"); context.ExecuteQueryWithTrace(); } } @@ -114,84 +114,84 @@ protected virtual void MapRegionalSettings(ClientRuntimeContext context, Regiona if (ReflectionUtils.HasPropertyPublicSetter(settings, "AdjustHijriDays") && definition.AdjustHijriDays.HasValue) { - context.AddQuery(new ClientActionSetProperty(settings, "AdjustHijriDays", definition.AdjustHijriDays.Value)); + ClientRuntimeQueryService.SetProperty(settings, "AdjustHijriDays", definition.AdjustHijriDays.Value); shouldUpdate = true; } if (ReflectionUtils.HasPropertyPublicSetter(settings, "AlternateCalendarType") && definition.AlternateCalendarType.HasValue) { - context.AddQuery(new ClientActionSetProperty(settings, "AlternateCalendarType", definition.AlternateCalendarType.Value)); + ClientRuntimeQueryService.SetProperty(settings, "AlternateCalendarType", definition.AlternateCalendarType.Value); shouldUpdate = true; } if (ReflectionUtils.HasPropertyPublicSetter(settings, "CalendarType") && definition.CalendarType.HasValue) { - context.AddQuery(new ClientActionSetProperty(settings, "CalendarType", definition.CalendarType.Value)); + ClientRuntimeQueryService.SetProperty(settings, "CalendarType", definition.CalendarType.Value); shouldUpdate = true; } if (ReflectionUtils.HasPropertyPublicSetter(settings, "Collation") && definition.Collation.HasValue) { - context.AddQuery(new ClientActionSetProperty(settings, "Collation", definition.Collation.Value)); + ClientRuntimeQueryService.SetProperty(settings, "Collation", definition.Collation.Value); shouldUpdate = true; } if (ReflectionUtils.HasPropertyPublicSetter(settings, "FirstDayOfWeek") && definition.FirstDayOfWeek.HasValue) { - context.AddQuery(new ClientActionSetProperty(settings, "FirstDayOfWeek", definition.FirstDayOfWeek.Value)); + ClientRuntimeQueryService.SetProperty(settings, "FirstDayOfWeek", definition.FirstDayOfWeek.Value); shouldUpdate = true; } if (ReflectionUtils.HasPropertyPublicSetter(settings, "FirstWeekOfYear") && definition.FirstWeekOfYear.HasValue) { - context.AddQuery(new ClientActionSetProperty(settings, "FirstWeekOfYear", definition.FirstWeekOfYear.Value)); + ClientRuntimeQueryService.SetProperty(settings, "FirstWeekOfYear", definition.FirstWeekOfYear.Value); shouldUpdate = true; } if (ReflectionUtils.HasPropertyPublicSetter(settings, "LocaleId") && definition.LocaleId.HasValue) { - context.AddQuery(new ClientActionSetProperty(settings, "LocaleId", definition.LocaleId.Value)); + ClientRuntimeQueryService.SetProperty(settings, "LocaleId", definition.LocaleId.Value); shouldUpdate = true; } if (ReflectionUtils.HasPropertyPublicSetter(settings, "WorkDayStartHour") && definition.WorkDayStartHour.HasValue) { - context.AddQuery(new ClientActionSetProperty(settings, "WorkDayStartHour", definition.WorkDayStartHour.Value)); + ClientRuntimeQueryService.SetProperty(settings, "WorkDayStartHour", definition.WorkDayStartHour.Value); shouldUpdate = true; } if (ReflectionUtils.HasPropertyPublicSetter(settings, "WorkDayEndHour") && definition.WorkDayEndHour.HasValue) { - context.AddQuery(new ClientActionSetProperty(settings, "WorkDayEndHour", definition.WorkDayEndHour.Value)); + ClientRuntimeQueryService.SetProperty(settings, "WorkDayEndHour", definition.WorkDayEndHour.Value); shouldUpdate = true; } if (ReflectionUtils.HasPropertyPublicSetter(settings, "WorkDays") && definition.WorkDays.HasValue) { - context.AddQuery(new ClientActionSetProperty(settings, "WorkDays", definition.WorkDays.Value)); + ClientRuntimeQueryService.SetProperty(settings, "WorkDays", definition.WorkDays.Value); shouldUpdate = true; } if (ReflectionUtils.HasPropertyPublicSetter(settings, "ShowWeeks") && definition.ShowWeeks.HasValue) { - context.AddQuery(new ClientActionSetProperty(settings, "ShowWeeks", definition.ShowWeeks.Value)); + ClientRuntimeQueryService.SetProperty(settings, "ShowWeeks", definition.ShowWeeks.Value); shouldUpdate = true; } if (ReflectionUtils.HasPropertyPublicSetter(settings, "Time24") && definition.Time24.HasValue) { - context.AddQuery(new ClientActionSetProperty(settings, "Time24", definition.Time24.Value)); + ClientRuntimeQueryService.SetProperty(settings, "Time24", definition.Time24.Value); shouldUpdate = true; } @@ -208,7 +208,7 @@ protected virtual void MapRegionalSettings(ClientRuntimeContext context, Regiona string.Format("Cannot find TimeZone by ID:[{0}]", definition.TimeZoneId)); } - context.AddQuery(new ClientActionSetProperty(settings, "TimeZone", targetZone)); + ClientRuntimeQueryService.SetProperty(settings, "TimeZone", targetZone); shouldUpdate = true; } } diff --git a/SPMeta2/SPMeta2.CSOM/ModelHandlers/SP2013WorkflowSubscriptionDefinitionModelHandler.cs b/SPMeta2/SPMeta2.CSOM/ModelHandlers/SP2013WorkflowSubscriptionDefinitionModelHandler.cs index 910302511..af1f7d9f5 100644 --- a/SPMeta2/SPMeta2.CSOM/ModelHandlers/SP2013WorkflowSubscriptionDefinitionModelHandler.cs +++ b/SPMeta2/SPMeta2.CSOM/ModelHandlers/SP2013WorkflowSubscriptionDefinitionModelHandler.cs @@ -212,9 +212,9 @@ private void DeployWebWorkflowSubscriptionDefinition( newSubscription.SetProperty("TaskListId", taskList.Id.ToString()); newSubscription.SetProperty("WebId", web.Id.ToString()); - newSubscription.SetProperty("Microsoft.SharePoint.ActivationProperties.WebId", web.Id.ToString()); - - MapProperties(currentSubscription, workflowSubscriptionModel); + newSubscription.SetProperty("Microsoft.SharePoint.ActivationProperties.WebId", web.Id.ToString()); + + MapProperties(newSubscription, workflowSubscriptionModel); InvokeOnModelEvent(this, new ModelEventArgs { @@ -340,9 +340,9 @@ private void DeployListWorkflowSubscriptionDefinition( newSubscription.SetProperty("TaskListId", taskList.Id.ToString()); newSubscription.SetProperty("ListId", list.Id.ToString()); - newSubscription.SetProperty("Microsoft.SharePoint.ActivationProperties.ListId", list.Id.ToString()); - - MapProperties(currentSubscription, workflowSubscriptionModel); + newSubscription.SetProperty("Microsoft.SharePoint.ActivationProperties.ListId", list.Id.ToString()); + + MapProperties(newSubscription, workflowSubscriptionModel); InvokeOnModelEvent(this, new ModelEventArgs { diff --git a/SPMeta2/SPMeta2.CSOM/ModelHandlers/SupportedUICultureModelHandler.cs b/SPMeta2/SPMeta2.CSOM/ModelHandlers/SupportedUICultureModelHandler.cs index a543e8f2a..517626462 100644 --- a/SPMeta2/SPMeta2.CSOM/ModelHandlers/SupportedUICultureModelHandler.cs +++ b/SPMeta2/SPMeta2.CSOM/ModelHandlers/SupportedUICultureModelHandler.cs @@ -1,124 +1,119 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Microsoft.SharePoint.Client; -using SPMeta2.Common; -using SPMeta2.CSOM.Extensions; -using SPMeta2.CSOM.ModelHosts; -using SPMeta2.Definitions; -using SPMeta2.Utils; -using System.Reflection; -using SPMeta2.Exceptions; -using SPMeta2.Services; - -namespace SPMeta2.CSOM.ModelHandlers -{ - - public class SupportedUICultureModelHandler : CSOMModelHandlerBase - { - #region methods - - public override Type TargetType - { - get { return typeof(SupportedUICultureDefinition); } - } - - public override void DeployModel(object modelHost, DefinitionBase model) - { - var webModel = model.WithAssertAndCast("model", value => value.RequireNotNull()); - var typedHost = modelHost.WithAssertAndCast("model", value => value.RequireNotNull()); - - var web = typedHost.HostWeb; - var context = web.Context; - - context.Load(web); - context.Load(web, w => w.SupportedUILanguageIds); - - context.ExecuteQuery(); - - InvokeOnModelEvent(this, new ModelEventArgs - { - CurrentModelNode = null, - Model = null, - EventType = ModelEventType.OnProvisioning, - Object = web, - ObjectType = typeof(Web), - ObjectDefinition = model, - ModelHost = modelHost - }); - - var shouldUpdate = false; - var currentLanguages = web.SupportedUILanguageIds; - - if (!currentLanguages.Contains(webModel.LCID)) - { - // if running nice CSOM, so that method is there and a few web's props - var supportedRuntime = ReflectionUtils.HasProperty(web, "IsMultilingual") - && ReflectionUtils.HasMethod(web, "AddSupportedUILanguage"); - - - if (supportedRuntime) - { - // TODO, wrap up into extensions - - // that's the trick to get all working on CSOM SP2013 SP1+ - // once props are there, we setup them - // if not, giving critical messages in logs - - // pushing IsMultilingual to true if false - var objectData = GetPropertyValue(web, "ObjectData"); - var objectProperties = GetPropertyValue(objectData, "Properties") as Dictionary; - - var isMultilingual = Convert.ToBoolean(objectProperties["IsMultilingual"]); - - if (!isMultilingual) - { - web.Context.AddQuery(new ClientActionSetProperty(web, "IsMultilingual", true)); - } - - // adding languages - var query = new ClientActionInvokeMethod(web, "AddSupportedUILanguage", new object[] - { - webModel.LCID - }); - - context.AddQuery(query); - - // upating the web - web.Update(); - - shouldUpdate = true; - } - else - { - TraceService.Critical((int)LogEventId.ModelProvisionCoreCall, - "CSOM runtime doesn't have Web.IsMultilingual and Web.AddSupportedUILanguage() methods support. Update CSOM runtime to a new version. SupportedUILanguage provision is skipped"); - } - } - - InvokeOnModelEvent(this, new ModelEventArgs - { - CurrentModelNode = null, - Model = null, - EventType = ModelEventType.OnProvisioned, - Object = web, - ObjectType = typeof(Web), - ObjectDefinition = model, - ModelHost = modelHost - }); - - if (shouldUpdate) - { - context.ExecuteQueryWithTrace(); - } - } - - - - #endregion - - - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Microsoft.SharePoint.Client; +using SPMeta2.Common; +using SPMeta2.CSOM.Extensions; +using SPMeta2.CSOM.ModelHosts; +using SPMeta2.Definitions; +using SPMeta2.Utils; +using System.Reflection; +using SPMeta2.Exceptions; +using SPMeta2.Services; + +namespace SPMeta2.CSOM.ModelHandlers +{ + + public class SupportedUICultureModelHandler : CSOMModelHandlerBase + { + #region methods + + public override Type TargetType + { + get { return typeof(SupportedUICultureDefinition); } + } + + public override void DeployModel(object modelHost, DefinitionBase model) + { + var webModel = model.WithAssertAndCast("model", value => value.RequireNotNull()); + var typedHost = modelHost.WithAssertAndCast("model", value => value.RequireNotNull()); + + var web = typedHost.HostWeb; + var context = web.Context; + + context.Load(web); + context.Load(web, w => w.SupportedUILanguageIds); + + context.ExecuteQuery(); + + InvokeOnModelEvent(this, new ModelEventArgs + { + CurrentModelNode = null, + Model = null, + EventType = ModelEventType.OnProvisioning, + Object = web, + ObjectType = typeof(Web), + ObjectDefinition = model, + ModelHost = modelHost + }); + + var shouldUpdate = false; + var currentLanguages = web.SupportedUILanguageIds; + + if (!currentLanguages.Contains(webModel.LCID)) + { + // if running nice CSOM, so that method is there and a few web's props + var supportedRuntime = ReflectionUtils.HasProperty(web, "IsMultilingual") + && ReflectionUtils.HasMethod(web, "AddSupportedUILanguage"); + + + if (supportedRuntime) + { + // TODO, wrap up into extensions + + // that's the trick to get all working on CSOM SP2013 SP1+ + // once props are there, we setup them + // if not, giving critical messages in logs + + // pushing IsMultilingual to true if false + var objectData = GetPropertyValue(web, "ObjectData"); + var objectProperties = GetPropertyValue(objectData, "Properties") as Dictionary; + + var isMultilingual = Convert.ToBoolean(objectProperties["IsMultilingual"]); + + if (!isMultilingual) + { + ClientRuntimeQueryService.SetProperty(web, "IsMultilingual", true); + } + + // adding languages + ClientRuntimeQueryService.InvokeMethod(web, "AddSupportedUILanguage", webModel.LCID); + + // upating the web + web.Update(); + + shouldUpdate = true; + } + else + { + TraceService.Critical((int)LogEventId.ModelProvisionCoreCall, + "CSOM runtime doesn't have Web.IsMultilingual and Web.AddSupportedUILanguage() methods support. Update CSOM runtime to a new version. SupportedUILanguage provision is skipped"); + } + } + + InvokeOnModelEvent(this, new ModelEventArgs + { + CurrentModelNode = null, + Model = null, + EventType = ModelEventType.OnProvisioned, + Object = web, + ObjectType = typeof(Web), + ObjectDefinition = model, + ModelHost = modelHost + }); + + if (shouldUpdate) + { + context.ExecuteQueryWithTrace(); + } + } + + + + #endregion + + + } +} diff --git a/SPMeta2/SPMeta2.CSOM/ModelHandlers/WebModelHandler.cs b/SPMeta2/SPMeta2.CSOM/ModelHandlers/WebModelHandler.cs index 8f1b8fe71..1b18f8ec4 100644 --- a/SPMeta2/SPMeta2.CSOM/ModelHandlers/WebModelHandler.cs +++ b/SPMeta2/SPMeta2.CSOM/ModelHandlers/WebModelHandler.cs @@ -396,7 +396,7 @@ public override void DeployModel(object modelHost, DefinitionBase model) } } - private static void MapProperties(Web web, WebDefinition webModel) + protected virtual void MapProperties(Web web, WebDefinition webModel) { if (!string.IsNullOrEmpty(webModel.Title)) web.Title = webModel.Title; @@ -411,20 +411,10 @@ private static void MapProperties(Web web, WebDefinition webModel) var context = web.Context; if (!string.IsNullOrEmpty(webModel.AlternateCssUrl)) - { - context.AddQuery(new ClientActionInvokeMethod(web, "AlternateCssUrl", new object[] - { - webModel.AlternateCssUrl - })); - } + ClientRuntimeQueryService.SetProperty(web, "AlternateCssUrl", webModel.AlternateCssUrl); if (!string.IsNullOrEmpty(webModel.SiteLogoUrl)) - { - context.AddQuery(new ClientActionInvokeMethod(web, "SiteLogoUrl", new object[] - { - webModel.SiteLogoUrl - })); - } + ClientRuntimeQueryService.SetProperty(web, "SiteLogoUrl", webModel.SiteLogoUrl); } else { @@ -435,15 +425,7 @@ private static void MapProperties(Web web, WebDefinition webModel) if (!string.IsNullOrEmpty(webModel.RequestAccessEmail)) { if (ReflectionUtils.HasProperty(web, "RequestAccessEmail")) - { - - var context = web.Context; - - context.AddQuery(new ClientActionInvokeMethod(web, "RequestAccessEmail", new object[] - { - webModel.SiteLogoUrl - })); - } + ClientRuntimeQueryService.SetProperty(web, "RequestAccessEmail", webModel.RequestAccessEmail); else { TraceService.Critical((int)LogEventId.ModelProvisionCoreCall, @@ -453,15 +435,7 @@ private static void MapProperties(Web web, WebDefinition webModel) if (webModel.MembersCanShare.HasValue) { if (ReflectionUtils.HasProperty(web, "MembersCanShare")) - { - var context = web.Context; - - context.AddQuery(new ClientActionInvokeMethod(web, "MembersCanShare", new object[] - { - webModel.MembersCanShare.Value - })); - - } + ClientRuntimeQueryService.SetProperty(web, "MembersCanShare", webModel.MembersCanShare.Value); else { TraceService.Critical((int)LogEventId.ModelProvisionCoreCall, diff --git a/SPMeta2/SPMeta2.CSOM/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.CSOM/Properties/AssemblyInfo.cs index 723773202..3b0f9130f 100644 --- a/SPMeta2/SPMeta2.CSOM/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2.CSOM/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.2.17040.0900")] +[assembly: AssemblyFileVersion("1.2.17057.1048")] diff --git a/SPMeta2/SPMeta2.CSOM/SPMeta2.CSOM.csproj b/SPMeta2/SPMeta2.CSOM/SPMeta2.CSOM.csproj index 56d3a263f..2da4b7c46 100644 --- a/SPMeta2/SPMeta2.CSOM/SPMeta2.CSOM.csproj +++ b/SPMeta2/SPMeta2.CSOM/SPMeta2.CSOM.csproj @@ -278,12 +278,14 @@ PublishingPageTemplates.resx + + diff --git a/SPMeta2/SPMeta2.CSOM/Services/CSOMLocalizationService.cs b/SPMeta2/SPMeta2.CSOM/Services/CSOMLocalizationService.cs index 0f3e88c2c..e59508f22 100644 --- a/SPMeta2/SPMeta2.CSOM/Services/CSOMLocalizationService.cs +++ b/SPMeta2/SPMeta2.CSOM/Services/CSOMLocalizationService.cs @@ -1,35 +1,36 @@ -using System; -using System.Globalization; -using Microsoft.SharePoint.Client; -using SPMeta2.Definitions; -using SPMeta2.Exceptions; -using SPMeta2.Services; -using SPMeta2.Utils; - -namespace SPMeta2.CSOM.Services -{ - public class CSOMLocalizationService : LocalizationServiceBase - { - public override void ProcessUserResource(object parentObject, object userResource, ValueForUICulture locValue) - { - var typedUserResource = userResource as ClientObject; - - if (typedUserResource == null) - throw new SPMeta2Exception("userResource should be an instance of ClientObject"); - - if (typedUserResource.GetType().Name.ToUpper() != "UserResource".ToUpper()) - throw new SPMeta2Exception("userResource should be an instance of UserResource"); - - var context = typedUserResource.Context; - var cultureInfo = GetUserResourceCultureInfo(locValue); - - var query = new ClientActionInvokeMethod(typedUserResource, "SetValueForUICulture", new object[] - { - cultureInfo.Name, - locValue.Value, - }); - - context.AddQuery(query); - } - } -} +using System; +using System.Globalization; +using Microsoft.SharePoint.Client; +using SPMeta2.Definitions; +using SPMeta2.Exceptions; +using SPMeta2.Services; +using SPMeta2.Utils; +using SPMeta2.CSOM.Services.Impl; + +namespace SPMeta2.CSOM.Services +{ + public class CSOMLocalizationService : LocalizationServiceBase + { + #region methods + + public override void ProcessUserResource(object parentObject, object userResource, ValueForUICulture locValue) + { + var typedUserResource = userResource as ClientObject; + + if (typedUserResource == null) + throw new SPMeta2Exception("userResource should be an instance of ClientObject"); + + if (typedUserResource.GetType().Name.ToUpper() != "UserResource".ToUpper()) + throw new SPMeta2Exception("userResource should be an instance of UserResource"); + + var context = typedUserResource.Context; + var cultureInfo = GetUserResourceCultureInfo(locValue); + + var clientRuntimeQueryService = ServiceContainer.Instance.GetService() ?? new DefaultClientRuntimeQueryService(); + + clientRuntimeQueryService.InvokeMethod(typedUserResource, "SetValueForUICulture", cultureInfo.Name, locValue.Value); + } + + #endregion + } +} diff --git a/SPMeta2/SPMeta2.CSOM/Services/CSOMTokenReplacementService.cs b/SPMeta2/SPMeta2.CSOM/Services/CSOMTokenReplacementService.cs index 09da6d9f1..33532627e 100644 --- a/SPMeta2/SPMeta2.CSOM/Services/CSOMTokenReplacementService.cs +++ b/SPMeta2/SPMeta2.CSOM/Services/CSOMTokenReplacementService.cs @@ -84,10 +84,39 @@ public override TokenReplacementResult ReplaceTokens(TokenReplacementContext con { if (!string.IsNullOrEmpty(result.Value)) { - result.Value = tokenInfo.RegEx.Replace(result.Value, ResolveToken(context, context.Context, tokenInfo.Name)); - - result.Value = result.Value.Replace(@"//", @"/"); - result.Value = result.Value.Replace(@"\\", @"\"); + var replacedValue = tokenInfo.RegEx.Replace(result.Value, ResolveToken(context, context.Context, tokenInfo.Name)); + + if (!string.IsNullOrEmpty(replacedValue)) + { + // everything to '/' + replacedValue = replacedValue.Replace(@"\", @"/"); + + // replace doubles after '://' + var urlParts = replacedValue.Split(new string[] { "://" }, StringSplitOptions.RemoveEmptyEntries); + + // return non 'protocol://' values + if (urlParts.Count() == 1) + { + result.Value = urlParts[0].Replace(@"//", @"/"); + } + else + { + var resultValues = new List(); + + resultValues.Add(urlParts[0]); + + foreach (var value in urlParts.Skip(1)) + { + resultValues.Add(value.Replace(@"//", @"/")); + } + + result.Value = string.Join("://", resultValues.ToArray()); + } + } + else + { + result.Value = replacedValue; + } } } diff --git a/SPMeta2/SPMeta2.CSOM/Services/ClientRuntimeQueryServiceBase.cs b/SPMeta2/SPMeta2.CSOM/Services/ClientRuntimeQueryServiceBase.cs new file mode 100644 index 000000000..8b4e4c935 --- /dev/null +++ b/SPMeta2/SPMeta2.CSOM/Services/ClientRuntimeQueryServiceBase.cs @@ -0,0 +1,34 @@ +using Microsoft.SharePoint.Client; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + + +namespace SPMeta2.CSOM.Services +{ + public abstract class ClientRuntimeQueryServiceBase + { + #region methods + public abstract void SetProperty(ClientObject clientObject, string propertyName, object propertyValue); + + + public void InvokeMethod(ClientObject clientObject, string methodName) + { + InvokeMethod(clientObject, methodName, (object[])null); + } + + public void InvokeMethod(ClientObject clientObject, string methodName, object methodParameter) + { + InvokeMethod(clientObject, methodName, new object[] { methodParameter }); + } + + public void InvokeMethod(ClientObject clientObject, string methodName, object p1, object p2) + { + InvokeMethod(clientObject, methodName, new object[] { p1, p2 }); + } + public abstract void InvokeMethod(ClientObject clientObject, string methodName, object[] methodParameters); + + #endregion + } +} diff --git a/SPMeta2/SPMeta2.CSOM/Services/Impl/DefaultClientRuntimeQueryServiceBase.cs b/SPMeta2/SPMeta2.CSOM/Services/Impl/DefaultClientRuntimeQueryServiceBase.cs new file mode 100644 index 000000000..b6fadb117 --- /dev/null +++ b/SPMeta2/SPMeta2.CSOM/Services/Impl/DefaultClientRuntimeQueryServiceBase.cs @@ -0,0 +1,31 @@ +using Microsoft.SharePoint.Client; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + + +namespace SPMeta2.CSOM.Services.Impl +{ + public class DefaultClientRuntimeQueryService : ClientRuntimeQueryServiceBase + { + #region methods + public override void SetProperty(ClientObject clientObject, string propertyName, object propertyValue) + { + var context = clientObject.Context; + var query = new ClientActionSetProperty(clientObject, propertyName, propertyValue); + + context.AddQuery(query); + } + + public override void InvokeMethod(ClientObject clientObject, string methodName, object[] methodParameters) + { + var context = clientObject.Context; + var query = new ClientActionInvokeMethod(clientObject, methodName, methodParameters); + + context.AddQuery(query); + } + + #endregion + } +} diff --git a/SPMeta2/SPMeta2.CSOM/Services/Impl/RequireCSOMRuntimeVersionDeploymentService.cs b/SPMeta2/SPMeta2.CSOM/Services/Impl/RequireCSOMRuntimeVersionDeploymentService.cs index c5bd0ce5e..62f8e1d89 100644 --- a/SPMeta2/SPMeta2.CSOM/Services/Impl/RequireCSOMRuntimeVersionDeploymentService.cs +++ b/SPMeta2/SPMeta2.CSOM/Services/Impl/RequireCSOMRuntimeVersionDeploymentService.cs @@ -64,17 +64,28 @@ protected virtual void CheckCSOMRuntimeVersion() // http://blogs.technet.com/b/steve_chen/archive/2013/03/26/3561010.aspx var spAssembly = GetCSOMRuntimeAssembly(); - var spAssemblyFileVersion = FileVersionInfo.GetVersionInfo(spAssembly.Location); - var versionInfo = GetCSOMRuntimeVersion(); + var assemblyLocation = string.Empty; + + // RequireCSOMRuntimeVersionDeploymentService does not work under Azure Funtions #962 + // https://github.com/SubPointSolutions/spmeta2/issues/962 + try + { + assemblyLocation = spAssembly.Location; + } + catch (Exception assemblyLocationLoadException) + { + assemblyLocation = string.Format("Coudn't load .Location property. Exception was:[{0}]", assemblyLocationLoadException); + } + TraceService.InformationFormat((int)LogEventId.ModelProcessing, "CSOM - CheckSharePointRuntimeVersion. Required minimal version :[{0}]. Current version: [{1}] Location: [{2}]", new object[] { - MinimalVersion, - spAssemblyFileVersion, - spAssemblyFileVersion.ProductVersion + MinimalVersion, + versionInfo, + assemblyLocation }); if (versionInfo.Major == 14) @@ -90,8 +101,8 @@ protected virtual void CheckCSOMRuntimeVersion() var exceptionMessage = string.Empty; exceptionMessage += string.Format("SPMeta2.CSOM.dll requires at least SP2013 SP1 runtime ({0}).{1}", MinimalVersion, Environment.NewLine); - exceptionMessage += string.Format(" Current Microsoft.SharePoint.Client.dll version:[{0}].{1}", spAssemblyFileVersion.ProductVersion, Environment.NewLine); - exceptionMessage += string.Format(" Current Microsoft.SharePoint.Client.dll location:[{0}].{1}", spAssembly.Location, Environment.NewLine); + exceptionMessage += string.Format(" Current Microsoft.SharePoint.Client.dll version:[{0}].{1}", versionInfo.Major, Environment.NewLine); + exceptionMessage += string.Format(" Current Microsoft.SharePoint.Client.dll location:[{0}].{1}", assemblyLocation, Environment.NewLine); throw new SPMeta2NotSupportedException(exceptionMessage); } @@ -110,11 +121,33 @@ protected virtual Assembly GetCSOMRuntimeAssembly() protected virtual Version GetCSOMRuntimeVersion() { var spAssembly = GetCSOMRuntimeAssembly(); - var spAssemblyFileVersion = FileVersionInfo.GetVersionInfo(spAssembly.Location); - var versionInfo = new Version(spAssemblyFileVersion.ProductVersion); + return GetAssemblyFileVersion(spAssembly); + } + + protected virtual Version GetAssemblyFileVersion(Assembly assembly) + { + var fileVersionAttribute = Attribute.GetCustomAttribute( + assembly, + typeof(AssemblyFileVersionAttribute), false) as AssemblyFileVersionAttribute; + + // paranoic about regression caused by MS changes in the future + if (fileVersionAttribute == null) + { + throw new SPMeta2Exception(string.Format( + "Cannot find AssemblyFileVersionAttribute in assembly:[{0}]", + assembly.FullName)); + } + + if (string.IsNullOrEmpty(fileVersionAttribute.Version)) + { + throw new SPMeta2Exception(string.Format( + "Found AssemblyFileVersionAttribute but .Version is null or empty. Assembly:[{0}]", + assembly.FullName)); + } + - return versionInfo; + return new Version(fileVersionAttribute.Version); } #endregion diff --git a/SPMeta2/SPMeta2.Containers.CSOM/CSOMProvisionRunner.cs b/SPMeta2/SPMeta2.Containers.CSOM/CSOMProvisionRunner.cs index 101fa9978..b45ac5b8b 100644 --- a/SPMeta2/SPMeta2.Containers.CSOM/CSOMProvisionRunner.cs +++ b/SPMeta2/SPMeta2.Containers.CSOM/CSOMProvisionRunner.cs @@ -69,7 +69,7 @@ private void InitServices() _provisionService.OnModelNodeProcessing += (sender, args) => { - Trace.WriteLine( + ContainerTraceUtils.WriteLine( string.Format("Processing: [{0}/{1}] - [{2:0} %] - [{3}] [{4}]", new object[] { args.ProcessedModelNodeCount, @@ -82,7 +82,7 @@ private void InitServices() _provisionService.OnModelNodeProcessed += (sender, args) => { - Trace.WriteLine( + ContainerTraceUtils.WriteLine( string.Format("Processed: [{0}/{1}] - [{2:0} %] - [{3}] [{4}]", new object[] { args.ProcessedModelNodeCount, @@ -162,7 +162,7 @@ public override void DeploySiteModel(ModelNode model) foreach (var siteUrl in SiteUrls) { - Trace.WriteLine(string.Format("[INF] Running on site: [{0}]", siteUrl)); + ContainerTraceUtils.WriteLine(string.Format("[INF] Running on site: [{0}]", siteUrl)); for (var provisionGeneration = 0; provisionGeneration < ProvisionGenerationCount; provisionGeneration++) { @@ -192,7 +192,7 @@ public override void DeployListModel(ModelNode model) { foreach (var webUrl in WebUrls) { - Trace.WriteLine(string.Format("[INF] Running on web: [{0}]", webUrl)); + ContainerTraceUtils.WriteLine(string.Format("[INF] Running on web: [{0}]", webUrl)); WithCSOMContext(webUrl, context => { @@ -252,7 +252,7 @@ public override void DeployWebModel(ModelNode model) foreach (var webUrl in WebUrls) { - Trace.WriteLine(string.Format("[INF] Running on web: [{0}]", webUrl)); + ContainerTraceUtils.WriteLine(string.Format("[INF] Running on web: [{0}]", webUrl)); WithCSOMContext(webUrl, context => { diff --git a/SPMeta2/SPMeta2.Containers.CSOM/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.Containers.CSOM/Properties/AssemblyInfo.cs index 45e1fda01..b9ee94793 100644 --- a/SPMeta2/SPMeta2.Containers.CSOM/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2.Containers.CSOM/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.2.17040.0900")] \ No newline at end of file +[assembly: AssemblyFileVersion("1.2.17057.1048")] \ No newline at end of file diff --git a/SPMeta2/SPMeta2.Containers.O365/O365ProvisionRunner.cs b/SPMeta2/SPMeta2.Containers.O365/O365ProvisionRunner.cs index d5ad80023..92a1c2ef1 100644 --- a/SPMeta2/SPMeta2.Containers.O365/O365ProvisionRunner.cs +++ b/SPMeta2/SPMeta2.Containers.O365/O365ProvisionRunner.cs @@ -61,7 +61,7 @@ private void InitServices() _provisionService.OnModelNodeProcessing += (sender, args) => { - Trace.WriteLine( + ContainerTraceUtils.WriteLine( string.Format("Processing: [{0}/{1}] - [{2:0} %] - [{3}] [{4}]", new object[] { args.ProcessedModelNodeCount, @@ -74,7 +74,7 @@ private void InitServices() _provisionService.OnModelNodeProcessed += (sender, args) => { - Trace.WriteLine( + ContainerTraceUtils.WriteLine( string.Format("Processed: [{0}/{1}] - [{2:0} %] - [{3}] [{4}]", new object[] { args.ProcessedModelNodeCount, @@ -188,7 +188,7 @@ public override void DeploySiteModel(ModelNode model) private void SiteOnUrl(ModelNode model, string siteUrl) { - Trace.WriteLine(string.Format("[INF] Running on site: [{0}]", siteUrl)); + ContainerTraceUtils.WriteLine(string.Format("[INF] Running on site: [{0}]", siteUrl)); for (var provisionGeneration = 0; provisionGeneration < ProvisionGenerationCount; @@ -225,7 +225,7 @@ public override void DeployListModel(ModelNode model) private void WebOnUrl(ModelNode model, string webUrl) { - Trace.WriteLine(string.Format("[INF] Running on web: [{0}]", webUrl)); + ContainerTraceUtils.WriteLine(string.Format("[INF] Running on web: [{0}]", webUrl)); WithO365Context(webUrl, context => { @@ -258,7 +258,7 @@ public override void DeployWebModel(ModelNode model) { foreach (var webUrl in WebUrls) { - Trace.WriteLine(string.Format("[INF] Running on web: [{0}]", webUrl)); + ContainerTraceUtils.WriteLine(string.Format("[INF] Running on web: [{0}]", webUrl)); diff --git a/SPMeta2/SPMeta2.Containers.O365/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.Containers.O365/Properties/AssemblyInfo.cs index ff23d1947..b87b1455a 100644 --- a/SPMeta2/SPMeta2.Containers.O365/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2.Containers.O365/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.2.17040.0900")] +[assembly: AssemblyFileVersion("1.2.17057.1048")] diff --git a/SPMeta2/SPMeta2.Containers.O365v16/O365v16ProvisionRunner.cs b/SPMeta2/SPMeta2.Containers.O365v16/O365v16ProvisionRunner.cs index f8bc80a11..2e72fa930 100644 --- a/SPMeta2/SPMeta2.Containers.O365v16/O365v16ProvisionRunner.cs +++ b/SPMeta2/SPMeta2.Containers.O365v16/O365v16ProvisionRunner.cs @@ -1,229 +1,262 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Security; -using Microsoft.SharePoint.Client; -using Microsoft.SharePoint.Client.Publishing.Navigation; -using Microsoft.SharePoint.Client.Search.Portability; -using Microsoft.SharePoint.Client.Taxonomy; -using Microsoft.SharePoint.Client.WorkflowServices; -using SPMeta2.Containers.Consts; -using SPMeta2.Containers.Services; -using SPMeta2.Containers.Utils; -using SPMeta2.CSOM.ModelHosts; -using SPMeta2.CSOM.Services; -using SPMeta2.CSOM.Standard.ModelHandlers.Fields; -using SPMeta2.ModelHandlers; -using SPMeta2.Models; -using SPMeta2.Regression.CSOM; -using SPMeta2.Regression.CSOM.Standard.Validation.Fields; -using SPMeta2.Utils; - -namespace SPMeta2.Containers.O365v16 -{ - /// - /// O365 container runner implementation. - /// - public class O365v16ProvisionRunner : ProvisionRunnerBase - { - #region constructors - - public O365v16ProvisionRunner() - { - Name = "O365"; - - SiteUrls = new List(); - WebUrls = new List(); - - LoadEnvironmentConfig(); - InitServices(); - - UserName = RunnerEnvironmentUtils.GetEnvironmentVariable(EnvironmentConsts.O365_UserName); - UserPassword = RunnerEnvironmentUtils.GetEnvironmentVariable(EnvironmentConsts.O365_Password); - } - - private void InitServices() - { - _provisionService = new CSOMProvisionService(); - _validationService = new CSOMValidationService(); - - var csomStandartAsm = typeof(TaxonomyFieldModelHandler).Assembly; - - foreach (var handlerType in ReflectionUtils.GetTypesFromAssembly(csomStandartAsm)) - _provisionService.RegisterModelHandler(Activator.CreateInstance(handlerType) as ModelHandlerBase); - - var csomtandartValidationAsm = typeof(ClientTaxonomyFieldDefinitionValidator).Assembly; - - foreach (var handlerType in ReflectionUtils.GetTypesFromAssembly(csomtandartValidationAsm)) - _validationService.RegisterModelHandler(Activator.CreateInstance(handlerType) as ModelHandlerBase); - } - - private void LoadEnvironmentConfig() - { - SiteUrls.Clear(); - SiteUrls.AddRange(RunnerEnvironmentUtils.GetEnvironmentVariables(EnvironmentConsts.O365_SiteUrls)); - - WebUrls.Clear(); - WebUrls.AddRange(RunnerEnvironmentUtils.GetEnvironmentVariables(EnvironmentConsts.O365_WebUrls)); - } - - #endregion - - #region properties - - /// - /// Target site URLs - /// - public List SiteUrls { get; set; } - - /// - /// Target web URLs - /// - public List WebUrls { get; set; } - - /// - /// User name - /// - public string UserName { get; set; } - - /// - /// User password - /// - public string UserPassword { get; set; } - - private CSOMProvisionService _provisionService; - private CSOMValidationService _validationService; - - - #endregion - - #region methods - - - /// - /// Resolves full name of the target type. - /// - /// - /// - /// - public override string ResolveFullTypeName(string typeName, string assemblyName) - { - var type = typeof(Field); - var workflow = typeof(WorkflowDefinition); - var store = typeof(TermStore); - var publishing = typeof(WebNavigationSettings); - var search = typeof(SearchConfigurationPortability); - - return base.ResolveFullTypeName(typeName, assemblyName); - } - - /// - /// Deploys and validates target site model. - /// - /// - public override void DeploySiteModel(ModelNode model) - { - foreach (var siteUrl in SiteUrls) - { - Trace.WriteLine(string.Format("[INF] Running on site: [{0}]", siteUrl)); - - - for (var provisionGeneration = 0; - provisionGeneration < ProvisionGenerationCount; - provisionGeneration++) - { - WithO365Context(siteUrl, context => - { - - if (EnableDefinitionProvision) - _provisionService.DeployModel(SiteModelHost.FromClientContext(context), model); - - if (EnableDefinitionValidation) - _validationService.DeployModel(SiteModelHost.FromClientContext(context), model); - - }); - - } - - } - } - - /// - /// Deploys and validates target web model. - /// - /// - public override void DeployWebModel(ModelNode model) - { - foreach (var webUrl in WebUrls) - { - Trace.WriteLine(string.Format("[INF] Running on web: [{0}]", webUrl)); - - - - for (var provisionGeneration = 0; - provisionGeneration < ProvisionGenerationCount; - provisionGeneration++) - { - WithO365Context(webUrl, context => - { - if (EnableDefinitionProvision) - _provisionService.DeployModel(WebModelHost.FromClientContext(context), model); - - if (EnableDefinitionValidation) - _validationService.DeployModel(WebModelHost.FromClientContext(context), model); - - }); - } - - - } - } - - #endregion - - #region utils - - #region static - - private static SecureString GetSecurePasswordString(string password) - { - var securePassword = new SecureString(); - - foreach (var s in password) - securePassword.AppendChar(s); - - return securePassword; - } - - #endregion - - /// - /// Invokes target action under O365 client context. - /// - /// - /// - public void WithO365Context(string siteUrl, Action action) - { - WithO365Context(siteUrl, UserName, UserPassword, action); - } - - /// - /// Invokes target action under O365 client context. - /// - /// - /// - /// - /// - private void WithO365Context(string siteUrl, string userName, string userPassword, Action action) - { - using (var context = new ClientContext(siteUrl)) - { - context.Credentials = new SharePointOnlineCredentials(userName, GetSecurePasswordString(userPassword)); - action(context); - } - } - - - #endregion - } -} +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Security; +using Microsoft.SharePoint.Client; +using Microsoft.SharePoint.Client.Publishing.Navigation; +using Microsoft.SharePoint.Client.Search.Portability; +using Microsoft.SharePoint.Client.Taxonomy; +using Microsoft.SharePoint.Client.WorkflowServices; +using SPMeta2.Containers.Consts; +using SPMeta2.Containers.Services; +using SPMeta2.Containers.Utils; +using SPMeta2.CSOM.ModelHosts; +using SPMeta2.CSOM.Services; +using SPMeta2.CSOM.Standard.ModelHandlers.Fields; +using SPMeta2.ModelHandlers; +using SPMeta2.Models; +using SPMeta2.Regression.CSOM; +using SPMeta2.Regression.CSOM.Standard.Validation.Fields; +using SPMeta2.Utils; + +namespace SPMeta2.Containers.O365v16 +{ + /// + /// O365 container runner implementation. + /// + public class O365v16ProvisionRunner : ProvisionRunnerBase + { + #region constructors + + public O365v16ProvisionRunner() + { + Name = "O365"; + + SiteUrls = new List(); + WebUrls = new List(); + + LoadEnvironmentConfig(); + InitServices(); + + UserName = RunnerEnvironmentUtils.GetEnvironmentVariable(EnvironmentConsts.O365_UserName); + UserPassword = RunnerEnvironmentUtils.GetEnvironmentVariable(EnvironmentConsts.O365_Password); + } + + private void InitServices() + { + _provisionService = new CSOMProvisionService(); + _validationService = new CSOMValidationService(); + + var csomStandartAsm = typeof(TaxonomyFieldModelHandler).Assembly; + + foreach (var handlerType in ReflectionUtils.GetTypesFromAssembly(csomStandartAsm)) + _provisionService.RegisterModelHandler(Activator.CreateInstance(handlerType) as ModelHandlerBase); + + var csomtandartValidationAsm = typeof(ClientTaxonomyFieldDefinitionValidator).Assembly; + + foreach (var handlerType in ReflectionUtils.GetTypesFromAssembly(csomtandartValidationAsm)) + _validationService.RegisterModelHandler(Activator.CreateInstance(handlerType) as ModelHandlerBase); + + _provisionService.OnModelNodeProcessing += (sender, args) => + { + ContainerTraceUtils.WriteLine( + string.Format("Processing: [{0}/{1}] - [{2:0} %] - [{3}] [{4}]", + new object[] { + args.ProcessedModelNodeCount, + args.TotalModelNodeCount, + 100d * (double)args.ProcessedModelNodeCount / (double)args.TotalModelNodeCount, + args.CurrentNode.Value.GetType().Name, + args.CurrentNode.Value + })); + }; + + _provisionService.OnModelNodeProcessed += (sender, args) => + { + ContainerTraceUtils.WriteLine( + string.Format("Processed: [{0}/{1}] - [{2:0} %] - [{3}] [{4}]", + new object[] { + args.ProcessedModelNodeCount, + args.TotalModelNodeCount, + 100d * (double)args.ProcessedModelNodeCount / (double)args.TotalModelNodeCount, + args.CurrentNode.Value.GetType().Name, + args.CurrentNode.Value + })); + }; + } + + private void LoadEnvironmentConfig() + { + SiteUrls.Clear(); + SiteUrls.AddRange(RunnerEnvironmentUtils.GetEnvironmentVariables(EnvironmentConsts.O365_SiteUrls)); + + WebUrls.Clear(); + WebUrls.AddRange(RunnerEnvironmentUtils.GetEnvironmentVariables(EnvironmentConsts.O365_WebUrls)); + } + + #endregion + + #region properties + + /// + /// Target site URLs + /// + public List SiteUrls { get; set; } + + /// + /// Target web URLs + /// + public List WebUrls { get; set; } + + /// + /// User name + /// + public string UserName { get; set; } + + /// + /// User password + /// + public string UserPassword { get; set; } + + private CSOMProvisionService _provisionService; + private CSOMValidationService _validationService; + + + #endregion + + #region methods + + + /// + /// Resolves full name of the target type. + /// + /// + /// + /// + public override string ResolveFullTypeName(string typeName, string assemblyName) + { + var type = typeof(Field); + var workflow = typeof(WorkflowDefinition); + var store = typeof(TermStore); + var publishing = typeof(WebNavigationSettings); + var search = typeof(SearchConfigurationPortability); + + return base.ResolveFullTypeName(typeName, assemblyName); + } + + /// + /// Deploys and validates target site model. + /// + /// + public override void DeploySiteModel(ModelNode model) + { + foreach (var siteUrl in SiteUrls) + { + ContainerTraceUtils.WriteLine(string.Format("[INF] Running on site: [{0}]", siteUrl)); + + + for (var provisionGeneration = 0; + provisionGeneration < ProvisionGenerationCount; + provisionGeneration++) + { + WithO365Context(siteUrl, context => + { + + if (EnableDefinitionProvision) + _provisionService.DeployModel(SiteModelHost.FromClientContext(context), model); + + if (EnableDefinitionValidation) + _validationService.DeployModel(SiteModelHost.FromClientContext(context), model); + + }); + + } + + } + } + + /// + /// Deploys and validates target web model. + /// + /// + public override void DeployWebModel(ModelNode model) + { + foreach (var webUrl in WebUrls) + { + ContainerTraceUtils.WriteLine(string.Format("[INF] Running on web: [{0}]", webUrl)); + + + + for (var provisionGeneration = 0; + provisionGeneration < ProvisionGenerationCount; + provisionGeneration++) + { + WithO365Context(webUrl, context => + { + if (EnableDefinitionProvision) + _provisionService.DeployModel(WebModelHost.FromClientContext(context), model); + + if (EnableDefinitionValidation) + _validationService.DeployModel(WebModelHost.FromClientContext(context), model); + + }); + } + + + } + } + + #endregion + + #region utils + + #region static + + private static SecureString GetSecurePasswordString(string password) + { + var securePassword = new SecureString(); + + foreach (var s in password) + securePassword.AppendChar(s); + + return securePassword; + } + + #endregion + + /// + /// Invokes target action under O365 client context. + /// + /// + /// + public void WithO365Context(string siteUrl, Action action) + { + WithO365Context(siteUrl, UserName, UserPassword, action); + } + + /// + /// Invokes target action under O365 client context. + /// + /// + /// + /// + /// + private void WithO365Context(string siteUrl, string userName, string userPassword, Action action) + { + using (var context = new ClientContext(siteUrl)) + { + context.Credentials = new SharePointOnlineCredentials(userName, GetSecurePasswordString(userPassword)); + + context.Load(context.Site, s => s.ServerRelativeUrl); + context.Load(context.Web); + context.Load(context.Web, s => s.ServerRelativeUrl); + + context.ExecuteQuery(); + + action(context); + } + } + + + #endregion + } +} diff --git a/SPMeta2/SPMeta2.Containers.O365v16/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.Containers.O365v16/Properties/AssemblyInfo.cs index 123738bec..b2d5576ef 100644 --- a/SPMeta2/SPMeta2.Containers.O365v16/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2.Containers.O365v16/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.2.17040.0900")] \ No newline at end of file +[assembly: AssemblyFileVersion("1.2.17057.1048")] \ No newline at end of file diff --git a/SPMeta2/SPMeta2.Containers.O365v16/SPMeta2.Containers.O365v16.csproj b/SPMeta2/SPMeta2.Containers.O365v16/SPMeta2.Containers.O365v16.csproj index e7f5df396..09de2dc46 100644 --- a/SPMeta2/SPMeta2.Containers.O365v16/SPMeta2.Containers.O365v16.csproj +++ b/SPMeta2/SPMeta2.Containers.O365v16/SPMeta2.Containers.O365v16.csproj @@ -1,164 +1,182 @@ - - - - - Debug - AnyCPU - {E9274D1F-BF08-44CB-9162-35110379D5C0} - Library - Properties - SPMeta2.Containers.O365v16 - SPMeta2.Containers.O365v16 - v4.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - bin\Debug40\ - - - true - bin\Debug45\ - DEBUG;TRACE - full - AnyCPU - prompt - MinimumRecommendedRules.ruleset - - - true - bin\CI-O365\ - DEBUG;TRACE - full - AnyCPU - prompt - MinimumRecommendedRules.ruleset - - - true - bin\CI-CSOM2013\ - DEBUG;TRACE - full - AnyCPU - prompt - MinimumRecommendedRules.ruleset - - - - False - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.0.2617.1200\Microsoft.Office.Client.Policy.dll - - - False - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.0.2617.1200\Microsoft.Office.Client.TranslationServices.dll - - - False - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.0.2617.1200\Microsoft.Office.Client.TranslationServices.Portable.dll - - - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.0.2617.1200\Microsoft.Online.SharePoint.Client.Tenant.dll - - - False - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.0.2617.1200\Microsoft.SharePoint.Client.dll - - - False - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.0.2617.1200\Microsoft.SharePoint.Client.DocumentManagement.dll - - - False - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.0.2617.1200\Microsoft.SharePoint.Client.DocumentManagement.Portable.dll - - - False - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.0.2617.1200\Microsoft.SharePoint.Client.Publishing.dll - - - False - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.0.2617.1200\Microsoft.SharePoint.Client.Runtime.dll - - - False - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.0.2617.1200\Microsoft.SharePoint.Client.Search.dll - - - False - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.0.2617.1200\Microsoft.SharePoint.Client.Search.Applications.dll - - - False - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.0.2617.1200\Microsoft.SharePoint.Client.Taxonomy.dll - - - False - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.0.2617.1200\Microsoft.SharePoint.Client.UserProfiles.dll - - - False - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.0.2617.1200\Microsoft.SharePoint.Client.WorkflowServices.dll - - - - - - - - - - - - - - - - {091C48FB-27E3-4F84-897C-5DE7BB55A2D3} - SPMeta2.Containers - - - {5E592EAA-E21F-4BF4-8EDF-6F6452DC916A} - SPMeta2.CSOM.Standard - - - {6F7EBF0C-7124-44D6-B9EC-302A54A19FE4} - SPMeta2.CSOM - - - {33B40E92-C649-41FC-B774-53D259801B3B} - SPMeta2.Regression.CSOM.Standard - - - {5A1B98BF-4EA4-4DEE-988F-FA62EEFC9EB0} - SPMeta2.Regression.CSOM - - - {EE49D3FD-6180-40E6-829F-6831FF89DAC6} - SPMeta2 - - - + + + + + Debug + AnyCPU + {E9274D1F-BF08-44CB-9162-35110379D5C0} + Library + Properties + SPMeta2.Containers.O365v16 + SPMeta2.Containers.O365v16 + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + bin\Debug40\ + + + true + bin\Debug45\ + DEBUG;TRACE + full + AnyCPU + prompt + MinimumRecommendedRules.ruleset + + + true + bin\CI-O365\ + DEBUG;TRACE + full + AnyCPU + prompt + MinimumRecommendedRules.ruleset + + + true + bin\CI-CSOM2013\ + DEBUG;TRACE + full + AnyCPU + prompt + MinimumRecommendedRules.ruleset + + + + False + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.Office.Client.Policy.dll + + + False + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.Office.Client.TranslationServices.dll + + + False + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.Office.SharePoint.Tools.dll + + + False + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.Online.SharePoint.Client.Tenant.dll + + + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.ProjectServer.Client.dll + + + False + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.dll + + + False + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.DocumentManagement.dll + + + False + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.Publishing.dll + + + False + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.Runtime.dll + + + False + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.Runtime.Windows.dll + + + False + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.Search.dll + + + False + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.Search.Applications.dll + + + False + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.Taxonomy.dll + + + False + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.UserProfiles.dll + + + False + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.WorkflowServices.dll + + + False + ..\SPMeta2.CSOM\bin\Debug45-365\SPMeta2.CSOM.dll + + + False + ..\SPMeta2.CSOM.Standard\bin\Debug45-365\SPMeta2.CSOM.Standard.dll + + + + True + ..\SPMeta2.CSOM\bin\Debug\SPMeta2.CSOM.dll + False + + + + True + ..\SPMeta2.CSOM\bin\Debug\SPMeta2.CSOM.Standard.dll + False + + + + + + + + + + + + + + + + + + {091C48FB-27E3-4F84-897C-5DE7BB55A2D3} + SPMeta2.Containers + + + {33B40E92-C649-41FC-B774-53D259801B3B} + SPMeta2.Regression.CSOM.Standard + + + {5A1B98BF-4EA4-4DEE-988F-FA62EEFC9EB0} + SPMeta2.Regression.CSOM + + + {EE49D3FD-6180-40E6-829F-6831FF89DAC6} + SPMeta2 + + + + --> \ No newline at end of file diff --git a/SPMeta2/SPMeta2.Containers.SSOM/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.Containers.SSOM/Properties/AssemblyInfo.cs index 9deaf7ebc..0e67140fa 100644 --- a/SPMeta2/SPMeta2.Containers.SSOM/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2.Containers.SSOM/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.2.17040.0900")] +[assembly: AssemblyFileVersion("1.2.17057.1048")] diff --git a/SPMeta2/SPMeta2.Containers.SSOM/SSOMProvisionRunner.cs b/SPMeta2/SPMeta2.Containers.SSOM/SSOMProvisionRunner.cs index 505ae73d6..1fe297c7f 100644 --- a/SPMeta2/SPMeta2.Containers.SSOM/SSOMProvisionRunner.cs +++ b/SPMeta2/SPMeta2.Containers.SSOM/SSOMProvisionRunner.cs @@ -80,7 +80,7 @@ private void InitServices() _provisionService.OnModelNodeProcessing += (sender, args) => { - Trace.WriteLine( + ContainerTraceUtils.WriteLine( string.Format("Processing: [{0}/{1}] - [{2:0} %] - [{3}] [{4}]", new object[] { args.ProcessedModelNodeCount, @@ -93,7 +93,7 @@ private void InitServices() _provisionService.OnModelNodeProcessed += (sender, args) => { - Trace.WriteLine( + ContainerTraceUtils.WriteLine( string.Format("Processed: [{0}/{1}] - [{2:0} %] - [{3}] [{4}]", new object[] { args.ProcessedModelNodeCount, @@ -183,7 +183,7 @@ public override void DeployWebApplicationModel(ModelNode model) foreach (var webAppUrl in WebApplicationUrls) { - Trace.WriteLine(string.Format("[INF] Running on web app: [{0}]", webAppUrl)); + ContainerTraceUtils.WriteLine(string.Format("[INF] Running on web app: [{0}]", webAppUrl)); for (var provisionGeneration = 0; provisionGeneration < ProvisionGenerationCount; provisionGeneration++) { @@ -341,7 +341,7 @@ public override void DeploySiteModel(ModelNode model) { //var siteUrl = GetTargetSiteCollectionUrl(); - Trace.WriteLine(string.Format("[INF] Running on site: [{0}]", siteUrl)); + ContainerTraceUtils.WriteLine(string.Format("[INF] Running on site: [{0}]", siteUrl)); for (var provisionGeneration = 0; provisionGeneration < ProvisionGenerationCount; provisionGeneration++) { @@ -367,7 +367,7 @@ public override void DeployWebModel(ModelNode model) //var webUrl = GetTargetSiteCollectionUrl(); - Trace.WriteLine(string.Format("[INF] Running on web: [{0}]", webUrl)); + ContainerTraceUtils.WriteLine(string.Format("[INF] Running on web: [{0}]", webUrl)); for (var provisionGeneration = 0; provisionGeneration < ProvisionGenerationCount; provisionGeneration++) { @@ -389,7 +389,7 @@ public override void DeployListModel(ModelNode model) { foreach (var webUrl in WebUrls) { - Trace.WriteLine(string.Format("[INF] Running on web: [{0}]", webUrl)); + ContainerTraceUtils.WriteLine(string.Format("[INF] Running on web: [{0}]", webUrl)); for (var provisionGeneration = 0; provisionGeneration < ProvisionGenerationCount; provisionGeneration++) { diff --git a/SPMeta2/SPMeta2.Containers.Standard/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.Containers.Standard/Properties/AssemblyInfo.cs index 3ef96a102..edf09de45 100644 --- a/SPMeta2/SPMeta2.Containers.Standard/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2.Containers.Standard/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.2.17040.0900")] +[assembly: AssemblyFileVersion("1.2.17057.1048")] diff --git a/SPMeta2/SPMeta2.Containers/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.Containers/Properties/AssemblyInfo.cs index 30ad9390f..732ce7dcb 100644 --- a/SPMeta2/SPMeta2.Containers/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2.Containers/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.2.17040.0900")] +[assembly: AssemblyFileVersion("1.2.17057.1048")] diff --git a/SPMeta2/SPMeta2.Containers/SPMeta2.Containers.csproj b/SPMeta2/SPMeta2.Containers/SPMeta2.Containers.csproj index 8598ce27e..4f58668d6 100644 --- a/SPMeta2/SPMeta2.Containers/SPMeta2.Containers.csproj +++ b/SPMeta2/SPMeta2.Containers/SPMeta2.Containers.csproj @@ -255,8 +255,9 @@ True DocumentTemplates.resx + - + True @@ -348,6 +349,9 @@ Always + + Always + diff --git a/SPMeta2/SPMeta2.Containers/Services/RegressionTestService.cs b/SPMeta2/SPMeta2.Containers/Services/RegressionTestService.cs index d0649c195..af51b7cee 100644 --- a/SPMeta2/SPMeta2.Containers/Services/RegressionTestService.cs +++ b/SPMeta2/SPMeta2.Containers/Services/RegressionTestService.cs @@ -149,7 +149,7 @@ protected virtual void InitRunnerTypes() { var runnerLibraries = RunnerEnvironmentUtils.GetEnvironmentVariable(EnvironmentConsts.RunnerLibraries); - Trace.WriteLine(string.Format("Testing with runner libraries: [{0}]", runnerLibraries)); + ContainerTraceUtils.WriteLine(string.Format("Testing with runner libraries: [{0}]", runnerLibraries)); if (!string.IsNullOrEmpty(runnerLibraries)) { @@ -498,11 +498,11 @@ public void TestModels(IEnumerable models, bool deployOnce) foreach (var model in models) { - Trace.WriteLine(string.Format(".ToPrettyPrint() result:")); - Trace.WriteLine(model.ToPrettyPrint()); + ContainerTraceUtils.WriteLine(string.Format(".ToPrettyPrint() result:")); + ContainerTraceUtils.WriteLine(model.ToPrettyPrint()); - Trace.WriteLine(string.Format(".ToDotGraph result:")); - Trace.WriteLine(model.ToDotGraph()); + ContainerTraceUtils.WriteLine(string.Format(".ToDotGraph result:")); + ContainerTraceUtils.WriteLine(model.ToDotGraph()); if (EnableDefinitionImmutabilityValidation) PersistDefinitionHashes(new[] { model }); @@ -667,12 +667,12 @@ public ModelValidationResult() private bool ResolveModelValidation(ModelNode modelNode, string start, List hooks) { // should be re-written with ModelTreeTraverseService - Trace.WriteLine(string.Format("")); + ContainerTraceUtils.WriteLine(string.Format("")); var hasMissedOrInvalidProps = false; var model = modelNode.Value; - Trace.WriteLine(string.Format("[INF]{2}MODEL CHECK [{0}] - ( {1} )", model.GetType(), model.ToString(), start)); + ContainerTraceUtils.WriteLine(string.Format("[INF]{2}MODEL CHECK [{0}] - ( {1} )", model.GetType(), model.ToString(), start)); //if (model.RequireSelfProcessing || modelNode.Options.RequireSelfProcessing) if (modelNode.Options.RequireSelfProcessing) @@ -698,7 +698,7 @@ private bool ResolveModelValidation(ModelNode modelNode, string start, List p.Name)) { @@ -777,7 +777,7 @@ var property in { if (!ShowOnlyFalseResults) { - Trace.WriteLine(string.Format("[INF]{2} [{0}] - [{1}]", + ContainerTraceUtils.WriteLine(string.Format("[INF]{2} [{0}] - [{1}]", "VALIDATED", shouldBeValidatedProp.Name, start)); @@ -785,7 +785,7 @@ var property in } else { - Trace.WriteLine(string.Format("[ERR]{2} [{0}] - [{1}]", + ContainerTraceUtils.WriteLine(string.Format("[ERR]{2} [{0}] - [{1}]", "MISSED", shouldBeValidatedProp.Name, start)); @@ -794,14 +794,14 @@ var property in } else { - Trace.WriteLine(string.Format("[INF]{0}EnablePropertyValidation == false. Skipping...", start)); + ContainerTraceUtils.WriteLine(string.Format("[INF]{0}EnablePropertyValidation == false. Skipping...", start)); } - Trace.WriteLine(string.Format("[INF]{0}EVENT CHECK", start)); + ContainerTraceUtils.WriteLine(string.Format("[INF]{0}EVENT CHECK", start)); if (EnableEventValidation && !modelNode.RegIsExcludeFromEventsValidation()) { - Trace.WriteLine(string.Format("[INF]{0}EnableEventValidation == true. Checking...", start)); + ContainerTraceUtils.WriteLine(string.Format("[INF]{0}EnableEventValidation == true. Checking...", start)); var hook = hooks.FirstOrDefault(h => h.ModelNode == modelNode); @@ -811,23 +811,23 @@ var property in } else { - Trace.WriteLine(string.Format("[ERR]{2} Missing hook validation for model [{0}] - ( {1} )", + ContainerTraceUtils.WriteLine(string.Format("[ERR]{2} Missing hook validation for model [{0}] - ( {1} )", model.GetType(), model.ToString(), start)); } } else { - Trace.WriteLine(string.Format("[INF]{0}EnableEventValidation == false. Skipping...", start)); + ContainerTraceUtils.WriteLine(string.Format("[INF]{0}EnableEventValidation == false. Skipping...", start)); } } else { - Trace.WriteLine(string.Format("[INF]{0} Skipping due .RegIsExcludedFromValidation == TRUE", start)); + ContainerTraceUtils.WriteLine(string.Format("[INF]{0} Skipping due .RegIsExcludedFromValidation == TRUE", start)); } } else { - Trace.WriteLine(string.Format("[INF]{0} Skipping due RequireSelfProcessing == FALSE", start)); + ContainerTraceUtils.WriteLine(string.Format("[INF]{0} Skipping due RequireSelfProcessing == FALSE", start)); } foreach (var childModel in modelNode.ChildModels) @@ -843,7 +843,7 @@ var property in protected void ResolveHook(EventHooks eventHooks, string start) { - TraceUtils.WithScope(traceScope => + IndentableTrace.WithScope(traceScope => { if (eventHooks.OnProvisioning) { @@ -884,17 +884,17 @@ protected void WithProvisionRunnerContext(Action action) CurrentProvisionRunner = provisionRunner; - Trace.WriteLine(string.Format("[INF] Testing with runner impl: [{0}]", type)); - Trace.WriteLine(string.Format("[INF] Testing with Is64BitProcess flag: [{0}]", Environment.Is64BitProcess)); - Trace.WriteLine(string.Format(@"[INF] Testing as user: [{0}\{1}]", Environment.UserDomainName, Environment.UserName)); - Trace.WriteLine(string.Empty); + ContainerTraceUtils.WriteLine(string.Format("[INF] Testing with runner impl: [{0}]", type)); + ContainerTraceUtils.WriteLine(string.Format("[INF] Testing with Is64BitProcess flag: [{0}]", Environment.Is64BitProcess)); + ContainerTraceUtils.WriteLine(string.Format(@"[INF] Testing as user: [{0}\{1}]", Environment.UserDomainName, Environment.UserName)); + ContainerTraceUtils.WriteLine(string.Empty); - Trace.WriteLine(string.Format("[INF] - Current VM: [{0}]", Environment.MachineName)); - Trace.WriteLine(string.Format("[INF] - Current VM CPU: [{0}]", Environment.ProcessorCount)); - Trace.WriteLine(string.Empty); + ContainerTraceUtils.WriteLine(string.Format("[INF] - Current VM: [{0}]", Environment.MachineName)); + ContainerTraceUtils.WriteLine(string.Format("[INF] - Current VM CPU: [{0}]", Environment.ProcessorCount)); + ContainerTraceUtils.WriteLine(string.Empty); - Trace.WriteLine(string.Format("[INF] - ProvisionGenerationCount: [{0}]", ProvisionGenerationCount)); - Trace.WriteLine(string.Format("[INF] - EnableDefinitionValidation: [{0}]", EnableDefinitionValidation)); + ContainerTraceUtils.WriteLine(string.Format("[INF] - ProvisionGenerationCount: [{0}]", ProvisionGenerationCount)); + ContainerTraceUtils.WriteLine(string.Format("[INF] - EnableDefinitionValidation: [{0}]", EnableDefinitionValidation)); action(new ProvisionRunnerContext { diff --git a/SPMeta2/SPMeta2.Containers/Services/Rnd/DefaultRandomService.cs b/SPMeta2/SPMeta2.Containers/Services/Rnd/DefaultRandomService.cs index 6408481fc..c08711a7e 100644 --- a/SPMeta2/SPMeta2.Containers/Services/Rnd/DefaultRandomService.cs +++ b/SPMeta2/SPMeta2.Containers/Services/Rnd/DefaultRandomService.cs @@ -1,117 +1,119 @@ -using System; -using System.Text; -using SPMeta2.Containers.Consts; -using SPMeta2.Containers.Utils; - -namespace SPMeta2.Containers.Services.Rnd -{ - public class DefaultRandomService : RandomService - { - double _defaultTrueProbability = 0.49; - private Random _rnd = new Random(); - - public override Guid Guid() - { - return System.Guid.NewGuid(); - } - - public override string String() - { - return String(32); - } - - public override string String(long lenght) - { - var iterations = (lenght / 32) + 1; - - var result = string.Empty; - - for (var i = 0; i < iterations; i++) - result += System.Guid.NewGuid().ToString("N"); - - return result.Substring(0, (int)lenght); - } - - public override int Int() - { - return Int(int.MaxValue); - } - - public override int Int(int maxValue) - { - return _rnd.Next(maxValue); - } - - public override double Double() - { - return Double(100); - } - - public override double Double(double maxValue) - { - return _rnd.NextDouble() * maxValue; - } - - public override bool Bool() - { - - return _rnd.NextDouble() < _defaultTrueProbability; - } - - public override string UserLogin() - { - var userLogins = RunnerEnvironmentUtils.GetEnvironmentVariable(EnvironmentConsts.DefaultTestUserLogins); - - if (!string.IsNullOrEmpty(userLogins)) - { - var logins = userLogins.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); - return logins[Int(logins.Length)]; - } - - throw new Exception(string.Format("Environment value [{0}] is NULL", EnvironmentConsts.DefaultTestUserLogins)); - } - - public override string UserEmail() - { - return string.Format("{0}@{0}.com", Environment.UserName); - } - - public override string UserName() - { - return string.Format("{0}", Environment.UserName); - } - - public override string ManagedPath() - { - return "sites"; - } - - public override byte[] Content() - { - return Content(32); - } - - public override byte[] Content(long lenght) - { - return Encoding.UTF8.GetBytes(String(lenght)); - } - - public override string DbServerName() - { - return string.Format("{0}", RunnerEnvironmentUtils.GetEnvironmentVariable(EnvironmentConsts.DefaultSqlServerName)); - } - - public override string ActiveDirectoryGroup() - { - var groups = RunnerEnvironmentUtils.GetEnvironmentVariable(EnvironmentConsts.DefaultTestADGroups); - - if (!string.IsNullOrEmpty(groups)) - { - var groupValues = groups.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); - return groupValues[Int(groupValues.Length)]; - } - - throw new Exception(string.Format("Environment value [{0}] is NULL", EnvironmentConsts.DefaultTestADGroups)); - } - } -} +using System; +using System.Text; +using SPMeta2.Containers.Consts; +using SPMeta2.Containers.Utils; + +namespace SPMeta2.Containers.Services.Rnd +{ + public class DefaultRandomService : RandomService + { + double _defaultTrueProbability = 0.49; + private Random _rnd = new Random(); + + public override Guid Guid() + { + return System.Guid.NewGuid(); + } + + public override string String() + { + return String(32); + } + + public override string String(long lenght) + { + var iterations = (lenght / 32) + 1; + + var result = string.Empty; + + for (var i = 0; i < iterations; i++) + result += System.Guid.NewGuid().ToString("N"); + + return result.Substring(0, (int)lenght); + } + + public override int Int() + { + return Int(int.MaxValue); + } + + public override int Int(int maxValue) + { + return _rnd.Next(maxValue); + } + + public override double Double() + { + return Double(100); + } + + public override double Double(double maxValue) + { + return _rnd.NextDouble() * maxValue; + } + + public override bool Bool() + { + + return _rnd.NextDouble() < _defaultTrueProbability; + } + + public override string UserLogin() + { + var userLogins = RunnerEnvironmentUtils.GetEnvironmentVariable(EnvironmentConsts.DefaultTestUserLogins); + + if (!string.IsNullOrEmpty(userLogins)) + { + var logins = userLogins.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); + return logins[Int(logins.Length)]; + } + + throw new Exception(string.Format("Environment value [{0}] is NULL", EnvironmentConsts.DefaultTestUserLogins)); + } + + public override string UserEmail() + { + return string.Format("{0}@{0}.com", Environment.UserName); + } + + public override string UserName() + { + return string.Format("{0}", Environment.UserName); + } + + public override string ManagedPath() + { + return "sites"; + } + + public override byte[] Content() + { + return Content(32); + } + + public override byte[] Content(long lenght) + { + return Encoding.UTF8.GetBytes(String(lenght)); + } + + public override string DbServerName() + { + var dbServerName = RunnerEnvironmentUtils.GetEnvironmentVariable(EnvironmentConsts.DefaultSqlServerName); + + return string.Format("{0}", dbServerName); + } + + public override string ActiveDirectoryGroup() + { + var groups = RunnerEnvironmentUtils.GetEnvironmentVariable(EnvironmentConsts.DefaultTestADGroups); + + if (!string.IsNullOrEmpty(groups)) + { + var groupValues = groups.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); + return groupValues[Int(groupValues.Length)]; + } + + throw new Exception(string.Format("Environment value [{0}] is NULL", EnvironmentConsts.DefaultTestADGroups)); + } + } +} diff --git a/SPMeta2/SPMeta2.Containers/Utils/ContainerTraceUtils.cs b/SPMeta2/SPMeta2.Containers/Utils/ContainerTraceUtils.cs new file mode 100644 index 000000000..f5efa42af --- /dev/null +++ b/SPMeta2/SPMeta2.Containers/Utils/ContainerTraceUtils.cs @@ -0,0 +1,30 @@ +using SPMeta2.Services; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SPMeta2.Containers.Utils +{ + public static class ContainerTraceUtils + { + #region static + + static ContainerTraceUtils() + { + } + + #endregion + + #region methods + + public static void WriteLine(string message) + { + var m2logService = ServiceContainer.Instance.GetService(); + m2logService.Information(0, message); + } + + #endregion + } +} diff --git a/SPMeta2/SPMeta2.Containers/Utils/IndentableTrace.cs b/SPMeta2/SPMeta2.Containers/Utils/IndentableTrace.cs new file mode 100644 index 000000000..227366db8 --- /dev/null +++ b/SPMeta2/SPMeta2.Containers/Utils/IndentableTrace.cs @@ -0,0 +1,72 @@ +using SPMeta2.Services; +using System; +using System.Diagnostics; + +namespace SPMeta2.Containers.Utils +{ + public class IndentableTrace + { + #region static + + static IndentableTrace() + { + DefaultIndentString = " "; + } + + + public static string DefaultIndentString { get; set; } + + public static void WithScope(Action action) + { + action(new IndentableTrace()); + } + + + #endregion + + #region properties + + protected int IndentIndex { get; set; } + protected string IndentString { get; set; } + + #endregion + + #region methods + + protected string GetCurrentIndent() + { + var result = string.Empty; + + for (var i = 0; i < IndentIndex; i++) + result += (IndentString ?? DefaultIndentString); + + return result; + } + + public IndentableTrace WriteLine(string traceMessage) + { + var m2logService = ServiceContainer.Instance.GetService(); + + m2logService.Information(0, string.Format("{0}{1}", GetCurrentIndent(), traceMessage)); + + return this; + } + + public IndentableTrace WithTraceIndent(Action action) + { + try + { + IndentIndex++; + action(this); + } + finally + { + IndentIndex--; + } + + return this; + } + + #endregion + } +} diff --git a/SPMeta2/SPMeta2.Containers/Utils/TraceUtils.cs b/SPMeta2/SPMeta2.Containers/Utils/TraceUtils.cs deleted file mode 100644 index 8a3313e1a..000000000 --- a/SPMeta2/SPMeta2.Containers/Utils/TraceUtils.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Diagnostics; - -namespace SPMeta2.Containers.Utils -{ - public class TraceUtils - { - #region static - - public static void WithScope(Action action) - { - action(new TraceUtils()); - } - - #endregion - - #region properties - - protected int IndentIndex { get; set; } - - #endregion - - #region methods - - protected string GetCurrentIndent() - { - var result = string.Empty; - - for (var i = 0; i < IndentIndex; i++) - result += " "; - - return result; - } - - public TraceUtils WriteLine(string traceMessage) - { - Trace.WriteLine(string.Format("{0}{1}", GetCurrentIndent(), traceMessage)); - - return this; - } - - public TraceUtils WithTraceIndent(Action action) - { - try - { - IndentIndex++; - action(this); - } - finally - { - IndentIndex--; - } - - return this; - } - - #endregion - } -} diff --git a/SPMeta2/SPMeta2.Nintex.CSOM/Class1.cs b/SPMeta2/SPMeta2.Nintex.CSOM/Class1.cs new file mode 100644 index 000000000..0aa2d4e16 --- /dev/null +++ b/SPMeta2/SPMeta2.Nintex.CSOM/Class1.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + + +namespace SPMeta2.Nintex.CSOM +{ + public class Class1 + { + } +} diff --git a/SPMeta2/SPMeta2.Nintex.CSOM/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.Nintex.CSOM/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..b8b030b13 --- /dev/null +++ b/SPMeta2/SPMeta2.Nintex.CSOM/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SPMeta2.Nintex.CSOM")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Vagrant")] +[assembly: AssemblyProduct("SPMeta2.Nintex.CSOM")] +[assembly: AssemblyCopyright("Copyright © Vagrant 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f6bed080-194b-43d7-bd31-6e3e1c1b120b")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.17057.1048")] diff --git a/SPMeta2/SPMeta2.Nintex.CSOM/SPMeta2.Nintex.CSOM.csproj b/SPMeta2/SPMeta2.Nintex.CSOM/SPMeta2.Nintex.CSOM.csproj new file mode 100644 index 000000000..e141fa8b5 --- /dev/null +++ b/SPMeta2/SPMeta2.Nintex.CSOM/SPMeta2.Nintex.CSOM.csproj @@ -0,0 +1,53 @@ + + + + + Debug + AnyCPU + {588FC30F-1C85-410E-AB20-C9741DB28857} + Library + Properties + SPMeta2.Nintex.CSOM + SPMeta2.Nintex.CSOM + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SPMeta2/SPMeta2.Nintex.SSOM/Class1.cs b/SPMeta2/SPMeta2.Nintex.SSOM/Class1.cs new file mode 100644 index 000000000..71ff76bdd --- /dev/null +++ b/SPMeta2/SPMeta2.Nintex.SSOM/Class1.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + + +namespace SPMeta2.Nintex.SSOM +{ + public class Class1 + { + } +} diff --git a/SPMeta2/SPMeta2.Nintex.SSOM/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.Nintex.SSOM/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..8dc2a59fb --- /dev/null +++ b/SPMeta2/SPMeta2.Nintex.SSOM/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SPMeta2.Nintex.SSOM")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Vagrant")] +[assembly: AssemblyProduct("SPMeta2.Nintex.SSOM")] +[assembly: AssemblyCopyright("Copyright © Vagrant 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("1560f275-9779-4d1b-95b1-454c9efb10b0")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.17057.1048")] diff --git a/SPMeta2/SPMeta2.Nintex.SSOM/SPMeta2.Nintex.SSOM.csproj b/SPMeta2/SPMeta2.Nintex.SSOM/SPMeta2.Nintex.SSOM.csproj new file mode 100644 index 000000000..03ad36fbe --- /dev/null +++ b/SPMeta2/SPMeta2.Nintex.SSOM/SPMeta2.Nintex.SSOM.csproj @@ -0,0 +1,53 @@ + + + + + Debug + AnyCPU + {788D7D6E-5347-4D09-BFF8-E83AD7CA1FD3} + Library + Properties + SPMeta2.Nintex.SSOM + SPMeta2.Nintex.SSOM + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SPMeta2/SPMeta2.Nintex/Class1.cs b/SPMeta2/SPMeta2.Nintex/Class1.cs new file mode 100644 index 000000000..c71836158 --- /dev/null +++ b/SPMeta2/SPMeta2.Nintex/Class1.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + + +namespace SPMeta2.Nintex +{ + public class Class1 + { + } +} diff --git a/SPMeta2/SPMeta2.Nintex/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.Nintex/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..1958401b4 --- /dev/null +++ b/SPMeta2/SPMeta2.Nintex/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SPMeta2.Nintex")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Vagrant")] +[assembly: AssemblyProduct("SPMeta2.Nintex")] +[assembly: AssemblyCopyright("Copyright © Vagrant 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("4582fc2f-033d-420d-9100-6f7928847855")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.17057.1048")] diff --git a/SPMeta2/SPMeta2.Nintex/SPMeta2.Nintex.csproj b/SPMeta2/SPMeta2.Nintex/SPMeta2.Nintex.csproj new file mode 100644 index 000000000..c79c983c3 --- /dev/null +++ b/SPMeta2/SPMeta2.Nintex/SPMeta2.Nintex.csproj @@ -0,0 +1,53 @@ + + + + + Debug + AnyCPU + {D19B0907-CED5-416A-9D45-0F112990C234} + Library + Properties + SPMeta2.Nintex + SPMeta2.Nintex + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SPMeta2/SPMeta2.O365/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.O365/Properties/AssemblyInfo.cs index ce90b40b6..23de1ba37 100644 --- a/SPMeta2/SPMeta2.O365/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2.O365/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.2.17040.0900")] +[assembly: AssemblyFileVersion("1.2.17057.1048")] diff --git a/SPMeta2/SPMeta2.Regression.CSOM.Standard/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.Regression.CSOM.Standard/Properties/AssemblyInfo.cs index 95e79b184..5a6b1dbf2 100644 --- a/SPMeta2/SPMeta2.Regression.CSOM.Standard/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2.Regression.CSOM.Standard/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.2.17040.0900")] +[assembly: AssemblyFileVersion("1.2.17057.1048")] diff --git a/SPMeta2/SPMeta2.Regression.CSOM.Standard/SPMeta2.Regression.CSOM.Standard.csproj b/SPMeta2/SPMeta2.Regression.CSOM.Standard/SPMeta2.Regression.CSOM.Standard.csproj index 361454f36..4d8c02af8 100644 --- a/SPMeta2/SPMeta2.Regression.CSOM.Standard/SPMeta2.Regression.CSOM.Standard.csproj +++ b/SPMeta2/SPMeta2.Regression.CSOM.Standard/SPMeta2.Regression.CSOM.Standard.csproj @@ -47,28 +47,31 @@ prompt MinimumRecommendedRules.ruleset - + + bin\Debug45-$(spRuntime)\ + v4.5 true - bin\CI-O365\ - DEBUG;TRACE full - AnyCPU - prompt - MinimumRecommendedRules.ruleset - - - true - bin\CI-CSOM2013\ + false DEBUG;TRACE - full - AnyCPU prompt - MinimumRecommendedRules.ruleset + 4 + false + bin\Debug45-$(spRuntime)\SPMeta2.Regression.CSOM.Standard.XML ..\..\packages\CsQuery.1.3.4\lib\net40\CsQuery.dll + + True + ..\SPMeta2.Dependencies\SharePoint\SP2010 - 14.0.4762.1000\CSOM\Microsoft.SharePoint.Client.dll + False + + + True + ..\SPMeta2.Dependencies\SharePoint\SP2010 - 14.0.4762.1000\CSOM\Microsoft.SharePoint.Client.Runtime.dll + True ..\SPMeta2.Dependencies\SharePoint\SP2013 - 15.0.4569.1000\CSOM\Microsoft.SharePoint.Client.dll @@ -94,38 +97,122 @@ True ..\SPMeta2.Dependencies\SharePoint\SP2013 - 15.0.4569.1000\CSOM\Microsoft.SharePoint.Client.Taxonomy.dll - + True - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.3912.1204\Microsoft.SharePoint.Client.dll + ..\SPMeta2.Dependencies\SharePoint\SP2013 - 15.0.4569.1000\CSOM\Microsoft.SharePoint.Client.WorkflowServices.dll + False - + True - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.3912.1204\Microsoft.SharePoint.Client.Publishing.dll + ..\SPMeta2.Dependencies\SharePoint\SP2013 - 15.0.4569.1000\CSOM\Microsoft.SharePoint.Client.DocumentManagement.dll + False - + True - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.3912.1204\Microsoft.SharePoint.Client.Runtime.dll + ..\SPMeta2.Dependencies\SharePoint\SP2016 - 16.0.4306.1001\CSOM\Microsoft.SharePoint.Client.dll + False - + True - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.3912.1204\Microsoft.SharePoint.Client.Search.dll + ..\SPMeta2.Dependencies\SharePoint\SP2016 - 16.0.4306.1001\CSOM\Microsoft.SharePoint.Client.Publishing.dll - + True - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.3912.1204\Microsoft.SharePoint.Client.Search.Applications.dll + ..\SPMeta2.Dependencies\SharePoint\SP2016 - 16.0.4306.1001\CSOM\Microsoft.SharePoint.Client.Runtime.dll - + True - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.3912.1204\Microsoft.SharePoint.Client.Taxonomy.dll + ..\SPMeta2.Dependencies\SharePoint\SP2016 - 16.0.4306.1001\CSOM\Microsoft.SharePoint.Client.Search.dll - + True - ..\SPMeta2.Dependencies\SharePoint\SP2013 - 15.0.4569.1000\CSOM\Microsoft.SharePoint.Client.WorkflowServices.dll + ..\SPMeta2.Dependencies\SharePoint\SP2016 - 16.0.4306.1001\CSOM\Microsoft.SharePoint.Client.Search.Applications.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\SP2016 - 16.0.4306.1001\CSOM\Microsoft.SharePoint.Client.Taxonomy.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\SP2016 - 16.0.4306.1001\CSOM\Microsoft.SharePoint.Client.WorkflowServices.dll + False + + + True + ..\SPMeta2.Dependencies\SharePoint\SP2016 - 16.0.4306.1001\CSOM\Microsoft.SharePoint.Client.DocumentManagement.dll False - + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.WorkflowServices.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.WorkflowServices.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.Publishing.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.Runtime.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.Search.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.Search.Applications.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.Taxonomy.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.DocumentManagement.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET40\Microsoft.SharePoint.Client.WorkflowServices.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET40\Microsoft.SharePoint.Client.WorkflowServices.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET40\Microsoft.SharePoint.Client.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET40\Microsoft.SharePoint.Client.Publishing.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET40\Microsoft.SharePoint.Client.Runtime.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET40\Microsoft.SharePoint.Client.Search.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET40\Microsoft.SharePoint.Client.Search.Applications.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET40\Microsoft.SharePoint.Client.Taxonomy.dll + + True - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.3912.1204\Microsoft.SharePoint.Client.WorkflowServices.dll + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET40\Microsoft.SharePoint.Client.DocumentManagement.dll diff --git a/SPMeta2/SPMeta2.Regression.CSOM/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.Regression.CSOM/Properties/AssemblyInfo.cs index 644c19884..8ff8140a9 100644 --- a/SPMeta2/SPMeta2.Regression.CSOM/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2.Regression.CSOM/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.2.17040.0900")] +[assembly: AssemblyFileVersion("1.2.17057.1048")] diff --git a/SPMeta2/SPMeta2.Regression.CSOM/SPMeta2.Regression.CSOM.csproj b/SPMeta2/SPMeta2.Regression.CSOM/SPMeta2.Regression.CSOM.csproj index c217a45b2..c67580285 100644 --- a/SPMeta2/SPMeta2.Regression.CSOM/SPMeta2.Regression.CSOM.csproj +++ b/SPMeta2/SPMeta2.Regression.CSOM/SPMeta2.Regression.CSOM.csproj @@ -27,55 +27,32 @@ - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - bin\1212\ - - - bin\Debug40\ - - - true - bin\Debug45\ - DEBUG;TRACE - bin\Debug\SPMeta2.Regression.CSOM.XML - full - AnyCPU - prompt - MinimumRecommendedRules.ruleset - - + + + bin\Debug45-$(spRuntime)\ + v4.5 true - bin\CI-O365\ - DEBUG;TRACE full - AnyCPU - prompt - MinimumRecommendedRules.ruleset - - - true - bin\CI-CSOM2013\ + false DEBUG;TRACE - full - AnyCPU prompt - MinimumRecommendedRules.ruleset + 4 + false + bin\Debug45-$(spRuntime)\SPMeta2.Regression.CSOM.XML + ..\..\packages\CsQuery.1.3.4\lib\net40\CsQuery.dll - + True - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.3912.1204\Microsoft.SharePoint.Client.WorkflowServices.dll + ..\SPMeta2.Dependencies\SharePoint\SP2010 - 14.0.4762.1000\CSOM\Microsoft.SharePoint.Client.dll + False + + + True + ..\SPMeta2.Dependencies\SharePoint\SP2010 - 14.0.4762.1000\CSOM\Microsoft.SharePoint.Client.Runtime.dll True @@ -91,13 +68,43 @@ ..\SPMeta2.Dependencies\SharePoint\SP2013 - 15.0.4569.1000\CSOM\Microsoft.SharePoint.Client.WorkflowServices.dll False - + + True + ..\SPMeta2.Dependencies\SharePoint\SP2016 - 16.0.4306.1001\CSOM\Microsoft.SharePoint.Client.dll + False + + + True + ..\SPMeta2.Dependencies\SharePoint\SP2016 - 16.0.4306.1001\CSOM\Microsoft.SharePoint.Client.Runtime.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\SP2016 - 16.0.4306.1001\CSOM\Microsoft.SharePoint.Client.WorkflowServices.dll + False + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.Runtime.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45\Microsoft.SharePoint.Client.WorkflowServices.dll + + + True + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET40\Microsoft.SharePoint.Client.dll + + True - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.3912.1204\Microsoft.SharePoint.Client.dll + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET40\Microsoft.SharePoint.Client.Runtime.dll - + True - ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.3912.1204\Microsoft.SharePoint.Client.Runtime.dll + ..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET40\Microsoft.SharePoint.Client.WorkflowServices.dll diff --git a/SPMeta2/SPMeta2.Regression.CSOM/Validation/ClientListViewDefinitionValidator.cs b/SPMeta2/SPMeta2.Regression.CSOM/Validation/ClientListViewDefinitionValidator.cs index 56c548355..f6723f957 100644 --- a/SPMeta2/SPMeta2.Regression.CSOM/Validation/ClientListViewDefinitionValidator.cs +++ b/SPMeta2/SPMeta2.Regression.CSOM/Validation/ClientListViewDefinitionValidator.cs @@ -10,6 +10,7 @@ using SPMeta2.CSOM.ModelHosts; using SPMeta2.Services; using System.Text.RegularExpressions; +using System; namespace SPMeta2.Regression.CSOM.Validation { @@ -42,6 +43,7 @@ public override void DeployModel(object modelHost, DefinitionBase model) v => v.Aggregations, v => v.ViewType, v => v.IncludeRootFolder, + v => v.HtmlSchemaXml, v => v.ViewData)); context.ExecuteQueryWithTrace(); @@ -111,27 +113,76 @@ public override void DeployModel(object modelHost, DefinitionBase model) else assert.SkipProperty(m => m.ViewData); - if (!string.IsNullOrEmpty(definition.Type)) + if (definition.Types.Count() == 0) { + assert.SkipProperty(m => m.Types, "Types.Count == 0"); + + if (!string.IsNullOrEmpty(definition.Type)) + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.Type); + var dstProp = d.GetExpressionValue(o => o.ViewType); + + var isValid = srcProp.Value.ToString().ToUpper() == + dstProp.Value.ToString().ToUpper(); + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = dstProp, + IsValid = isValid + }; + }); + } + else + assert.SkipProperty(m => m.Type); + } + else + { + assert.SkipProperty(m => m.Type, "Types.Count != 0"); + assert.ShouldBeEqual((p, s, d) => { - var srcProp = s.GetExpressionValue(def => def.Type); - var dstProp = d.GetExpressionValue(o => o.ViewType); + var srcProp = s.GetExpressionValue(def => def.Types); + //var dstProp = d.GetExpressionValue(o => o.Type); - var isValid = srcProp.Value.ToString().ToUpper() == - dstProp.Value.ToString().ToUpper(); + var isValid = false; + + ViewType? srcType = null; + + foreach (var type in s.Types) + { + var tmpViewType = (ViewType)Enum.Parse(typeof(ViewType), type); + + if (srcType == null) + srcType = tmpViewType; + else + srcType = srcType | tmpViewType; + } + + var srcTypeValue = (int)srcType; + var dstTypeValue = (int)0; + + // checking if only reccurence set + // test designed that way only + if (((int)srcTypeValue & (int)(ViewType.Recurrence)) == + (int)ViewType.Recurrence) + { + // nah, whatever, it works and does the job + isValid = d.HtmlSchemaXml.Contains("RecurrenceRowset=\"TRUE\""); + } return new PropertyValidationResult { Tag = p.Tag, Src = srcProp, - Dst = dstProp, + Dst = null, IsValid = isValid }; }); } - else - assert.SkipProperty(m => m.Type); assert.SkipProperty(m => m.ViewStyleId, "ViewStyleId unsupported by SP CSOM API yet. Skipping."); assert.SkipProperty(m => m.TabularView, "TabularView unsupported by SP CSOM API yet. Skipping."); @@ -228,7 +279,30 @@ public override void DeployModel(object modelHost, DefinitionBase model) if (string.IsNullOrEmpty(definition.Aggregations)) assert.SkipProperty(m => m.Aggregations, "Aggregations is null or empty. Skipping."); else - assert.ShouldBeEqual(m => m.Aggregations, o => o.Aggregations); + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.Aggregations); + var dstProp = d.GetExpressionValue(ct => ct.Aggregations); + + var isValid = s.Aggregations + .Replace("'", string.Empty) + .Replace(" ", string.Empty) + .Replace("\"", string.Empty) == + d.Aggregations + .Replace("'", string.Empty) + .Replace(" ", string.Empty) + .Replace("\"", string.Empty); + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = dstProp, + IsValid = isValid + }; + }); + } assert.ShouldBePartOfIfNotNullOrEmpty(m => m.Url, o => o.ServerRelativeUrl); diff --git a/SPMeta2/SPMeta2.Regression.CSOM/Validation/ClientSP2013WorkflowDefinitionValidator.cs b/SPMeta2/SPMeta2.Regression.CSOM/Validation/ClientSP2013WorkflowDefinitionValidator.cs index cd9a9a1f2..b0d37533d 100644 --- a/SPMeta2/SPMeta2.Regression.CSOM/Validation/ClientSP2013WorkflowDefinitionValidator.cs +++ b/SPMeta2/SPMeta2.Regression.CSOM/Validation/ClientSP2013WorkflowDefinitionValidator.cs @@ -7,7 +7,8 @@ using SPMeta2.CSOM.ModelHosts; using SPMeta2.Definitions; using SPMeta2.Definitions.Base; -using SPMeta2.Utils; +using SPMeta2.Utils; +using SPMeta2.Containers.Assertion; namespace SPMeta2.Regression.CSOM.Validation { @@ -33,10 +34,57 @@ public override void DeployModel(object modelHost, DefinitionBase model) .ShouldNotBeNull(spObject) .SkipProperty(m => m.Override, "Override is not supported yet.") .ShouldBeEqual(m => m.Xaml, o => o.Xaml) - .ShouldBeEqual(m => m.DisplayName, o => o.DisplayName); - - - // TODO, check Override later + .ShouldBeEqual(m => m.DisplayName, o => o.DisplayName); + + + if (!string.IsNullOrEmpty(definition.RestrictToScope)) + assert.ShouldBeEqual(m => m.RestrictToScope, o => o.RestrictToScope); + else + assert.SkipProperty(p => p.RestrictToScope); + + if (!string.IsNullOrEmpty(definition.RestrictToType)) + assert.ShouldBeEqual(m => m.RestrictToType, o => o.RestrictToType); + else + assert.SkipProperty(p => p.RestrictToType); + + if (definition.Properties.Count() > 0) + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.Properties); + var dstProp = d.GetExpressionValue(ct => ct.Properties); + + var isValid = true; + + foreach (var prop in s.Properties) + { + var propName = prop.Name; + var propValue = prop.Value; + + if (!d.Properties.ContainsKey(propName)) + { + isValid = false; + } + + if (d.Properties[propName] != propValue) + { + isValid = false; + } + } + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = dstProp, + IsValid = isValid + }; + }); + } + else + { + assert.SkipProperty(p => p.Properties, ".Properties.Count() = 0. Skipping"); + } } } } diff --git a/SPMeta2/SPMeta2.Regression.CSOM/Validation/ClientSP2013WorkflowSubscriptionDefinitionValidator.cs b/SPMeta2/SPMeta2.Regression.CSOM/Validation/ClientSP2013WorkflowSubscriptionDefinitionValidator.cs index ad7ca6d56..b3c60ac9e 100644 --- a/SPMeta2/SPMeta2.Regression.CSOM/Validation/ClientSP2013WorkflowSubscriptionDefinitionValidator.cs +++ b/SPMeta2/SPMeta2.Regression.CSOM/Validation/ClientSP2013WorkflowSubscriptionDefinitionValidator.cs @@ -167,7 +167,46 @@ private void ValidateWorkflowSubscription(object modelHost, #endregion - #endregion + #endregion + + if (definition.Properties.Count() > 0) + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.Properties); + var dstProp = d.GetExpressionValue(ct => ct.PropertyDefinitions); + + var isValid = true; + + foreach (var prop in s.Properties) + { + var propName = prop.Name; + var propValue = prop.Value; + + if (!d.PropertyDefinitions.ContainsKey(propName)) + { + isValid = false; + } + + if (d.PropertyDefinitions[propName] != propValue) + { + isValid = false; + } + } + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = dstProp, + IsValid = isValid + }; + }); + } + else + { + assert.SkipProperty(p => p.Properties, ".Properties.Count() = 0. Skipping"); + } } } } diff --git a/SPMeta2/SPMeta2.Regression.CSOM/Validation/ClientWebDefinitionValidator.cs b/SPMeta2/SPMeta2.Regression.CSOM/Validation/ClientWebDefinitionValidator.cs index f9ae9066a..edae845c8 100644 --- a/SPMeta2/SPMeta2.Regression.CSOM/Validation/ClientWebDefinitionValidator.cs +++ b/SPMeta2/SPMeta2.Regression.CSOM/Validation/ClientWebDefinitionValidator.cs @@ -1,284 +1,339 @@ -using System; -using System.Linq; - -using Microsoft.SharePoint.Client; - -using SPMeta2.Containers.Assertion; -using SPMeta2.CSOM.Extensions; -using SPMeta2.CSOM.ModelHandlers; -using SPMeta2.Definitions; -using SPMeta2.Regression.CSOM.Extensions; -using SPMeta2.Services; -using SPMeta2.Utils; -using System.Text; - -namespace SPMeta2.Regression.CSOM.Validation -{ - public class ClientWebDefinitionValidator : WebModelHandler - { - public override void DeployModel(object modelHost, DefinitionBase model) - { - var hostClientContext = ExtractHostClientContext(modelHost); - - var parentWeb = ExtractWeb(modelHost); - var definition = model.WithAssertAndCast("model", value => value.RequireNotNull()); - - var currentWebUrl = GetCurrentWebUrl(parentWeb.Context, parentWeb, definition); - var spObject = GetExistingWeb(hostClientContext.Site, parentWeb, currentWebUrl); - var context = spObject.Context; - - context.Load(spObject, - w => w.HasUniqueRoleAssignments, - w => w.Description, - w => w.Url, - w => w.Language, - w => w.WebTemplate, - w => w.Configuration, - w => w.Title, - w => w.Id, - w => w.AllProperties - ); - - context.ExecuteQueryWithTrace(); - - var assert = ServiceFactory.AssertService - .NewAssert(definition, spObject) - .ShouldBeEqual(m => m.Title, o => o.Title) - .ShouldBeEqual(m => m.LCID, o => o.GetLCID()) - .ShouldBeEqual(m => m.UseUniquePermission, o => o.HasUniqueRoleAssignments); - - if (!string.IsNullOrEmpty(definition.WebTemplate)) - { - assert.ShouldBeEqual(m => m.WebTemplate, o => o.GetWebTemplate()); - assert.SkipProperty(m => m.CustomWebTemplate); - } - else - { - assert.SkipProperty(m => m.WebTemplate); - assert.SkipProperty(m => m.CustomWebTemplate); - } - - assert.ShouldBeEqualIfNotNullOrEmpty(m => m.Description, o => o.Description); - - assert.ShouldBeEqual((p, s, d) => - { - if (!parentWeb.IsObjectPropertyInstantiated("Url")) - { - parentWeb.Context.Load(parentWeb, o => o.Url); - parentWeb.Context.ExecuteQueryWithTrace(); - } - - var srcProp = s.GetExpressionValue(def => def.Url); - var dstProp = d.GetExpressionValue(ct => ct.Url); - - var srcUrl = s.Url; - var dstUrl = d.Url; - - srcUrl = UrlUtility.RemoveStartingSlash(srcUrl); - - var dstSubUrl = dstUrl.Replace(parentWeb.Url + "/", string.Empty); - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = dstProp, - IsValid = srcUrl == dstSubUrl - }; - }); - +using System; +using System.Linq; + +using Microsoft.SharePoint.Client; + +using SPMeta2.Containers.Assertion; +using SPMeta2.CSOM.Extensions; +using SPMeta2.CSOM.ModelHandlers; +using SPMeta2.Definitions; +using SPMeta2.Regression.CSOM.Extensions; +using SPMeta2.Services; +using SPMeta2.Utils; +using System.Text; + +namespace SPMeta2.Regression.CSOM.Validation +{ + public class ClientWebDefinitionValidator : WebModelHandler + { + public override void DeployModel(object modelHost, DefinitionBase model) + { + var hostClientContext = ExtractHostClientContext(modelHost); + + var parentWeb = ExtractWeb(modelHost); + var definition = model.WithAssertAndCast("model", value => value.RequireNotNull()); + + var currentWebUrl = GetCurrentWebUrl(parentWeb.Context, parentWeb, definition); + var spObject = GetExistingWeb(hostClientContext.Site, parentWeb, currentWebUrl); + var context = spObject.Context; + + context.Load(spObject, + w => w.HasUniqueRoleAssignments, + w => w.Description, + w => w.Url, + w => w.Language, + w => w.WebTemplate, + w => w.Configuration, + w => w.Title, + w => w.Id, + w => w.AllProperties + ); + + context.ExecuteQueryWithTrace(); + + var assert = ServiceFactory.AssertService + .NewAssert(definition, spObject) + .ShouldBeEqual(m => m.Title, o => o.Title) + .ShouldBeEqual(m => m.LCID, o => o.GetLCID()) + .ShouldBeEqual(m => m.UseUniquePermission, o => o.HasUniqueRoleAssignments); + + if (!string.IsNullOrEmpty(definition.WebTemplate)) + { + assert.ShouldBeEqual(m => m.WebTemplate, o => o.GetWebTemplate()); + assert.SkipProperty(m => m.CustomWebTemplate); + } + else + { + assert.SkipProperty(m => m.WebTemplate); + assert.SkipProperty(m => m.CustomWebTemplate); + } + + assert.ShouldBeEqualIfNotNullOrEmpty(m => m.Description, o => o.Description); + + assert.ShouldBeEqual((p, s, d) => + { + if (!parentWeb.IsObjectPropertyInstantiated("Url")) + { + parentWeb.Context.Load(parentWeb, o => o.Url); + parentWeb.Context.ExecuteQueryWithTrace(); + } + + var srcProp = s.GetExpressionValue(def => def.Url); + var dstProp = d.GetExpressionValue(ct => ct.Url); + + var srcUrl = s.Url; + var dstUrl = d.Url; + + srcUrl = UrlUtility.RemoveStartingSlash(srcUrl); + + var dstSubUrl = dstUrl.Replace(parentWeb.Url + "/", string.Empty); + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = dstProp, + IsValid = srcUrl == dstSubUrl + }; + }); + var supportsAlternateCssAndSiteImageUrl = ReflectionUtils.HasProperties(spObject, new[] { "AlternateCssUrl", "SiteLogoUrl" - }); - - if (supportsAlternateCssAndSiteImageUrl) - { - if (!string.IsNullOrEmpty(definition.AlternateCssUrl)) - { - var alternateCssUrl = ReflectionUtils.GetPropertyValue(spObject, "AlternateCssUrl"); - - assert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(def => def.AlternateCssUrl); - var isValid = true; - - isValid = s.AlternateCssUrl.ToUpper().EndsWith(alternateCssUrl.ToString().ToUpper()); - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = null, - IsValid = isValid - }; - }); - } - else - { - assert.SkipProperty(m => m.AlternateCssUrl); - } - - if (!string.IsNullOrEmpty(definition.SiteLogoUrl)) - { - var siteLogoUrl = ReflectionUtils.GetPropertyValue(spObject, "SiteLogoUrl"); - - assert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(def => def.SiteLogoUrl); - - var isValid = s.SiteLogoUrl.ToUpper().EndsWith(siteLogoUrl.ToString().ToUpper()); - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = null, - IsValid = isValid - }; - }); - } - else - { - assert.SkipProperty(m => m.SiteLogoUrl); - } - } - else - { - TraceService.Critical((int)LogEventId.ModelProvisionCoreCall, - "CSOM runtime doesn't have Web.AlternateCssUrl and Web.SiteLogoUrl methods support. Skipping validation."); - - assert.SkipProperty(m => m.AlternateCssUrl, "AlternateCssUrl is null or empty. Skipping."); - assert.SkipProperty(m => m.SiteLogoUrl, "SiteLogoUrl is null or empty. Skipping."); - } - + }); + + if (supportsAlternateCssAndSiteImageUrl) + { + // also check for MembersCanShare / RequestAccessEmail + if (definition.MembersCanShare.HasValue) + { + var membersCanShare = ConvertUtils.ToBool(ReflectionUtils.GetPropertyValue(spObject, "MembersCanShare")).Value; + + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.MembersCanShare); + var isValid = true; + + isValid = s.MembersCanShare.Value == membersCanShare; + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = null, + IsValid = isValid + }; + }); + } + else + { + assert.SkipProperty(m => m.MembersCanShare); + } + + if (!string.IsNullOrEmpty(definition.RequestAccessEmail)) + { + var requestAccessEmail = ReflectionUtils.GetPropertyValue(spObject, "RequestAccessEmail"); + + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.RequestAccessEmail); + var isValid = true; + + isValid = s.RequestAccessEmail.ToUpper() == requestAccessEmail.ToString().ToUpper(); + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = null, + IsValid = isValid + }; + }); + } + else + { + assert.SkipProperty(m => m.RequestAccessEmail); + } + + + if (!string.IsNullOrEmpty(definition.AlternateCssUrl)) + { + var alternateCssUrl = ReflectionUtils.GetPropertyValue(spObject, "AlternateCssUrl"); + + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.AlternateCssUrl); + var isValid = true; + + isValid = s.AlternateCssUrl.ToUpper().EndsWith(alternateCssUrl.ToString().ToUpper()); + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = null, + IsValid = isValid + }; + }); + } + else + { + assert.SkipProperty(m => m.AlternateCssUrl); + } + + if (!string.IsNullOrEmpty(definition.SiteLogoUrl)) + { + var siteLogoUrl = ReflectionUtils.GetPropertyValue(spObject, "SiteLogoUrl"); + + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.SiteLogoUrl); + + var isValid = s.SiteLogoUrl.ToUpper().EndsWith(siteLogoUrl.ToString().ToUpper()); + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = null, + IsValid = isValid + }; + }); + } + else + { + assert.SkipProperty(m => m.SiteLogoUrl); + } + } + else + { + TraceService.Critical((int)LogEventId.ModelProvisionCoreCall, + "CSOM runtime doesn't have Web.AlternateCssUrl and Web.SiteLogoUrl methods support. Skipping validation."); + + assert.SkipProperty(m => m.AlternateCssUrl, "AlternateCssUrl is null or empty. Skipping."); + assert.SkipProperty(m => m.SiteLogoUrl, "SiteLogoUrl is null or empty. Skipping."); + + assert.SkipProperty(m => m.MembersCanShare, "SiteLogoUrl is null or empty. Skipping."); + assert.SkipProperty(m => m.RequestAccessEmail, "SiteLogoUrl is null or empty. Skipping."); + } + var supportsLocalization = ReflectionUtils.HasProperties(spObject, new[] { "TitleResource", "DescriptionResource" - }); - - if (supportsLocalization) - { - if (definition.TitleResource.Any()) - { - assert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(def => def.TitleResource); - var isValid = true; - - foreach (var userResource in s.TitleResource) - { - var culture = LocalizationService.GetUserResourceCultureInfo(userResource); - var resourceObject = ReflectionUtils.GetPropertyValue(spObject, "TitleResource"); - - var value = ReflectionUtils.GetMethod(resourceObject, "GetValueForUICulture") - .Invoke(resourceObject, new[] { culture.Name }) as ClientResult; - - context.ExecuteQuery(); - - isValid = userResource.Value == value.Value; - - if (!isValid) - break; - } - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = null, - IsValid = isValid - }; - }); - } - else - { - assert.SkipProperty(m => m.TitleResource, "TitleResource is NULL or empty. Skipping."); - } - - if (definition.DescriptionResource.Any()) - { - assert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(def => def.DescriptionResource); - var isValid = true; - - foreach (var userResource in s.DescriptionResource) - { - var culture = LocalizationService.GetUserResourceCultureInfo(userResource); - var resourceObject = ReflectionUtils.GetPropertyValue(spObject, "DescriptionResource"); - - var value = ReflectionUtils.GetMethod(resourceObject, "GetValueForUICulture") - .Invoke(resourceObject, new[] { culture.Name }) as ClientResult; - - context.ExecuteQuery(); - - isValid = userResource.Value == value.Value; - - if (!isValid) - break; - } - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = null, - IsValid = isValid - }; - }); - } - else - { - assert.SkipProperty(m => m.DescriptionResource, "DescriptionResource is NULL or empty. Skipping."); - } - } - else - { - TraceService.Critical((int)LogEventId.ModelProvisionCoreCall, - "CSOM runtime doesn't have Web.TitleResource and Web.DescriptionResource() methods support. Skipping validation."); - - assert.SkipProperty(m => m.TitleResource, "TitleResource is null or empty. Skipping."); - assert.SkipProperty(m => m.DescriptionResource, "DescriptionResource is null or empty. Skipping."); - } - - if (definition.IndexedPropertyKeys.Any()) - { - assert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(def => def.IndexedPropertyKeys); - - var isValid = false; - - if (d.AllProperties.FieldValues.ContainsKey("vti_indexedpropertykeys")) - { - // check props, TODO - - // check vti_indexedpropertykeys - var indexedPropertyKeys = d.AllProperties["vti_indexedpropertykeys"] - .ToString() - .Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries) - .Select(es => Encoding.Unicode.GetString(System.Convert.FromBase64String(es))); - - // Search if any indexPropertyKey from definition is not in WebModel - var differentKeys = s.IndexedPropertyKeys.Select(o => o.Name) - .Except(indexedPropertyKeys); - - isValid = !differentKeys.Any(); - } - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = null, - IsValid = isValid - }; - }); - } - else - assert.SkipProperty(m => m.IndexedPropertyKeys, "IndexedPropertyKeys is NULL or empty. Skipping."); - } - } -} + }); + + if (supportsLocalization) + { + if (definition.TitleResource.Any()) + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.TitleResource); + var isValid = true; + + foreach (var userResource in s.TitleResource) + { + var culture = LocalizationService.GetUserResourceCultureInfo(userResource); + var resourceObject = ReflectionUtils.GetPropertyValue(spObject, "TitleResource"); + + var value = ReflectionUtils.GetMethod(resourceObject, "GetValueForUICulture") + .Invoke(resourceObject, new[] { culture.Name }) as ClientResult; + + context.ExecuteQuery(); + + isValid = userResource.Value == value.Value; + + if (!isValid) + break; + } + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = null, + IsValid = isValid + }; + }); + } + else + { + assert.SkipProperty(m => m.TitleResource, "TitleResource is NULL or empty. Skipping."); + } + + if (definition.DescriptionResource.Any()) + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.DescriptionResource); + var isValid = true; + + foreach (var userResource in s.DescriptionResource) + { + var culture = LocalizationService.GetUserResourceCultureInfo(userResource); + var resourceObject = ReflectionUtils.GetPropertyValue(spObject, "DescriptionResource"); + + var value = ReflectionUtils.GetMethod(resourceObject, "GetValueForUICulture") + .Invoke(resourceObject, new[] { culture.Name }) as ClientResult; + + context.ExecuteQuery(); + + isValid = userResource.Value == value.Value; + + if (!isValid) + break; + } + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = null, + IsValid = isValid + }; + }); + } + else + { + assert.SkipProperty(m => m.DescriptionResource, "DescriptionResource is NULL or empty. Skipping."); + } + } + else + { + TraceService.Critical((int)LogEventId.ModelProvisionCoreCall, + "CSOM runtime doesn't have Web.TitleResource and Web.DescriptionResource() methods support. Skipping validation."); + + assert.SkipProperty(m => m.TitleResource, "TitleResource is null or empty. Skipping."); + assert.SkipProperty(m => m.DescriptionResource, "DescriptionResource is null or empty. Skipping."); + } + + if (definition.IndexedPropertyKeys.Any()) + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.IndexedPropertyKeys); + + var isValid = false; + + if (d.AllProperties.FieldValues.ContainsKey("vti_indexedpropertykeys")) + { + // check props, TODO + + // check vti_indexedpropertykeys + var indexedPropertyKeys = d.AllProperties["vti_indexedpropertykeys"] + .ToString() + .Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries) + .Select(es => Encoding.Unicode.GetString(System.Convert.FromBase64String(es))); + + // Search if any indexPropertyKey from definition is not in WebModel + var differentKeys = s.IndexedPropertyKeys.Select(o => o.Name) + .Except(indexedPropertyKeys); + + isValid = !differentKeys.Any(); + } + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = null, + IsValid = isValid + }; + }); + } + else + assert.SkipProperty(m => m.IndexedPropertyKeys, "IndexedPropertyKeys is NULL or empty. Skipping."); + } + } +} diff --git a/SPMeta2/SPMeta2.Regression.CSOM/Validation/Extended/ClientWebpartPresenceOnPageDefinitionValidator.cs b/SPMeta2/SPMeta2.Regression.CSOM/Validation/Extended/ClientWebpartPresenceOnPageDefinitionValidator.cs index 24a0de7f1..b756f1aac 100644 --- a/SPMeta2/SPMeta2.Regression.CSOM/Validation/Extended/ClientWebpartPresenceOnPageDefinitionValidator.cs +++ b/SPMeta2/SPMeta2.Regression.CSOM/Validation/Extended/ClientWebpartPresenceOnPageDefinitionValidator.cs @@ -45,7 +45,7 @@ DefinitionBase definitionBase var isValid = true; - TraceUtils.WithScope(trace => + IndentableTrace.WithScope(trace => { trace.WriteLine(string.Format("Checking web part presence on the page:[{0}]", pageUrl)); diff --git a/SPMeta2/SPMeta2.Regression.CSOM/Validation/Extended/XsltListViewWebPartGridModePresenceValidator.cs b/SPMeta2/SPMeta2.Regression.CSOM/Validation/Extended/XsltListViewWebPartGridModePresenceValidator.cs index ef961a68c..5b81055bf 100644 --- a/SPMeta2/SPMeta2.Regression.CSOM/Validation/Extended/XsltListViewWebPartGridModePresenceValidator.cs +++ b/SPMeta2/SPMeta2.Regression.CSOM/Validation/Extended/XsltListViewWebPartGridModePresenceValidator.cs @@ -40,7 +40,7 @@ protected override void ValidateHtmlPage(File file, string pageUrl, string pageC var isValid = true; - TraceUtils.WithScope(trace => + IndentableTrace.WithScope(trace => { trace.WriteLine(string.Format("Checking InitGridFromView presence:[{0}]", pageUrl)); diff --git a/SPMeta2/SPMeta2.Regression.CSOM/Validation/Fields/CalculatedFieldDefinitionValidator.cs b/SPMeta2/SPMeta2.Regression.CSOM/Validation/Fields/CalculatedFieldDefinitionValidator.cs index e39d0728d..0af80c4a2 100644 --- a/SPMeta2/SPMeta2.Regression.CSOM/Validation/Fields/CalculatedFieldDefinitionValidator.cs +++ b/SPMeta2/SPMeta2.Regression.CSOM/Validation/Fields/CalculatedFieldDefinitionValidator.cs @@ -1,89 +1,93 @@ -using System; -using System.Linq; -using Microsoft.SharePoint.Client; -using SPMeta2.Containers.Assertion; -using SPMeta2.Definitions; -using SPMeta2.Definitions.Fields; -using SPMeta2.Regression.CSOM.Utils; -using SPMeta2.Utils; - -namespace SPMeta2.Regression.CSOM.Validation.Fields -{ - public class CalculatedFieldDefinitionValidator : ClientFieldDefinitionValidator - { - public override Type TargetType - { - get - { - return typeof(CalculatedFieldDefinition); - } - } - - public override void DeployModel(object modelHost, DefinitionBase model) - { - var definition = model.WithAssertAndCast("model", value => value.RequireNotNull()); - var spObject = GetField(modelHost, definition); - - var assert = ServiceFactory.AssertService.NewAssert(model, definition, spObject); - - ValidateField(assert, spObject, definition); - - var typedField = spObject.Context.CastTo(spObject); - - var typedDefinition = model.WithAssertAndCast("model", value => value.RequireNotNull()); - var typedFieldAssert = ServiceFactory.AssertService.NewAssert(model, typedDefinition, typedField); - - typedFieldAssert.ShouldBeEqual(m => m.CurrencyLocaleId, o => o.GetCurrencyLocaleId()); - typedFieldAssert.ShouldBeEqual(m => m.DateFormat, o => o.GetDateFormatString()); - - typedFieldAssert.ShouldBeEqual(m => m.OutputType, o => o.GetOutputType()); - //typedFieldAssert.ShouldBeEqual(m => m.ShowAsPercentage, o => o.GetShowAsPercentage()); - typedFieldAssert.ShouldBeEqual(m => m.DisplayFormat, o => o.GetDisplayFormatString()); - - if (typedDefinition.ShowAsPercentage.HasValue) - typedFieldAssert.ShouldBeEqual(m => m.ShowAsPercentage, o => o.GetShowAsPercentage()); - else - typedFieldAssert.SkipProperty(m => m.ShowAsPercentage, "ShowAsPercentage is NULL. Skipping."); - - - // formula - if (!string.IsNullOrEmpty(typedDefinition.Formula)) - typedFieldAssert.ShouldBeEqual(m => m.Formula, o => o.Formula); - else - typedFieldAssert.SkipProperty(m => m.Formula); - - // field refs - if (typedDefinition.FieldReferences.Count > 0) - { - var hasFieldRefs = true; - - foreach (var dstFieldRef in typedField.GetFieldReferences()) - { - if (typedDefinition.FieldReferences.FirstOrDefault(c => c.ToUpper() == dstFieldRef.ToUpper()) == null) - { - hasFieldRefs = false; - } - } - - typedFieldAssert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(m => m.FieldReferences); - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = null, - IsValid = hasFieldRefs == true - }; - }); - } - else - { - typedFieldAssert.SkipProperty(m => m.FieldReferences, "FieldReferences.Count == 0. Skipping."); - } - } - } - - -} +using System; +using System.Linq; +using Microsoft.SharePoint.Client; +using SPMeta2.Containers.Assertion; +using SPMeta2.Definitions; +using SPMeta2.Definitions.Fields; +using SPMeta2.Regression.CSOM.Utils; +using SPMeta2.Utils; + +namespace SPMeta2.Regression.CSOM.Validation.Fields +{ + public class CalculatedFieldDefinitionValidator : ClientFieldDefinitionValidator + { + public override Type TargetType + { + get + { + return typeof(CalculatedFieldDefinition); + } + } + + public override void DeployModel(object modelHost, DefinitionBase model) + { + var definition = model.WithAssertAndCast("model", value => value.RequireNotNull()); + var spObject = GetField(modelHost, definition); + + var assert = ServiceFactory.AssertService.NewAssert(model, definition, spObject); + + ValidateField(assert, spObject, definition); + + var typedField = spObject.Context.CastTo(spObject); + + var typedDefinition = model.WithAssertAndCast("model", value => value.RequireNotNull()); + var typedFieldAssert = ServiceFactory.AssertService.NewAssert(model, typedDefinition, typedField); + + typedFieldAssert.ShouldBeEqual(m => m.CurrencyLocaleId, o => o.GetCurrencyLocaleId()); + typedFieldAssert.ShouldBeEqual(m => m.DateFormat, o => o.GetDateFormatString()); + + typedFieldAssert.ShouldBeEqual(m => m.OutputType, o => o.GetOutputType()); + //typedFieldAssert.ShouldBeEqual(m => m.ShowAsPercentage, o => o.GetShowAsPercentage()); + + if (!string.IsNullOrEmpty(typedDefinition.DisplayFormat)) + typedFieldAssert.ShouldBeEqual(m => m.DisplayFormat, o => o.GetDisplayFormatString()); + else + typedFieldAssert.SkipProperty(m => m.DisplayFormat, "DisplayFormat is NULL. Skipping."); + + if (typedDefinition.ShowAsPercentage.HasValue) + typedFieldAssert.ShouldBeEqual(m => m.ShowAsPercentage, o => o.GetShowAsPercentage()); + else + typedFieldAssert.SkipProperty(m => m.ShowAsPercentage, "ShowAsPercentage is NULL. Skipping."); + + + // formula + if (!string.IsNullOrEmpty(typedDefinition.Formula)) + typedFieldAssert.ShouldBeEqual(m => m.Formula, o => o.Formula); + else + typedFieldAssert.SkipProperty(m => m.Formula); + + // field refs + if (typedDefinition.FieldReferences.Count > 0) + { + var hasFieldRefs = true; + + foreach (var dstFieldRef in typedField.GetFieldReferences()) + { + if (typedDefinition.FieldReferences.FirstOrDefault(c => c.ToUpper() == dstFieldRef.ToUpper()) == null) + { + hasFieldRefs = false; + } + } + + typedFieldAssert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(m => m.FieldReferences); + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = null, + IsValid = hasFieldRefs == true + }; + }); + } + else + { + typedFieldAssert.SkipProperty(m => m.FieldReferences, "FieldReferences.Count == 0. Skipping."); + } + } + } + + +} diff --git a/SPMeta2/SPMeta2.Regression.CSOM/Validation/Fields/NumberFieldDefinitionValidator.cs b/SPMeta2/SPMeta2.Regression.CSOM/Validation/Fields/NumberFieldDefinitionValidator.cs index 0ecd2a3b3..e32069496 100644 --- a/SPMeta2/SPMeta2.Regression.CSOM/Validation/Fields/NumberFieldDefinitionValidator.cs +++ b/SPMeta2/SPMeta2.Regression.CSOM/Validation/Fields/NumberFieldDefinitionValidator.cs @@ -1,45 +1,47 @@ -using System; -using Microsoft.SharePoint.Client; -using SPMeta2.Definitions; -using SPMeta2.Definitions.Fields; -using SPMeta2.Enumerations; -using SPMeta2.Regression.CSOM.Utils; -using SPMeta2.Utils; - -namespace SPMeta2.Regression.CSOM.Validation.Fields -{ - public class NumberFieldDefinitionValidator : ClientFieldDefinitionValidator - { - public override Type TargetType - { - get - { - return typeof(NumberFieldDefinition); - } - } - - public override void DeployModel(object modelHost, DefinitionBase model) - { - var definition = model.WithAssertAndCast("model", value => value.RequireNotNull()); - var spObject = GetField(modelHost, definition); - - var assert = ServiceFactory.AssertService.NewAssert(model, definition, spObject); - - ValidateField(assert, spObject, definition); - - var textField = spObject.Context.CastTo(spObject); - var textDefinition = model.WithAssertAndCast("model", value => value.RequireNotNull()); - - var typedFieldAssert = ServiceFactory.AssertService.NewAssert(model, textDefinition, textField); - - typedFieldAssert.ShouldBeEqual(m => m.MaximumValue, o => o.MaximumValue); - typedFieldAssert.ShouldBeEqual(m => m.MinimumValue, o => o.MinimumValue); - typedFieldAssert.ShouldBeEqual(m => m.ShowAsPercentage, o => o.GetShowAsPercentage()); - - if (!string.IsNullOrEmpty(textDefinition.DisplayFormat)) - typedFieldAssert.ShouldBeEqual(m => m.DisplayFormat, o => o.GetDecimalsAsString()); - else - typedFieldAssert.SkipProperty(m => m.DisplayFormat, "DisplayFormat is null or empty. Skipping."); - } - } -} +using System; +using Microsoft.SharePoint.Client; +using SPMeta2.Definitions; +using SPMeta2.Definitions.Fields; +using SPMeta2.Enumerations; +using SPMeta2.Regression.CSOM.Utils; +using SPMeta2.Utils; + +namespace SPMeta2.Regression.CSOM.Validation.Fields +{ + public class NumberFieldDefinitionValidator : ClientFieldDefinitionValidator + { + public override Type TargetType + { + get + { + return typeof(NumberFieldDefinition); + } + } + + public override void DeployModel(object modelHost, DefinitionBase model) + { + var definition = model.WithAssertAndCast("model", value => value.RequireNotNull()); + var spObject = GetField(modelHost, definition); + + var assert = ServiceFactory.AssertService.NewAssert(model, definition, spObject); + + ValidateField(assert, spObject, definition); + + var textField = spObject.Context.CastTo(spObject); + var textDefinition = model.WithAssertAndCast("model", value => value.RequireNotNull()); + + var typedFieldAssert = ServiceFactory.AssertService.NewAssert(model, textDefinition, textField); + + typedFieldAssert.ShouldBeEqual(m => m.MaximumValue, o => o.MaximumValue); + typedFieldAssert.ShouldBeEqual(m => m.MinimumValue, o => o.MinimumValue); + typedFieldAssert.ShouldBeEqual(m => m.ShowAsPercentage, o => o.GetShowAsPercentage()); + + typedFieldAssert.SkipProperty(m => m.DisplayFormat, "Skipping validation as this field is unchangable in CSOM API."); + + //if (!string.IsNullOrEmpty(textDefinition.DisplayFormat)) + // typedFieldAssert.ShouldBeEqual(m => m.DisplayFormat, o => o.GetDecimalsAsString()); + //else + // typedFieldAssert.SkipProperty(m => m.DisplayFormat, "DisplayFormat is null or empty. Skipping."); + } + } +} diff --git a/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Build/BuildBaselineTests.cs b/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Build/BuildBaselineTests.cs index c0a51ce7a..4f00672be 100644 --- a/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Build/BuildBaselineTests.cs +++ b/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Build/BuildBaselineTests.cs @@ -12,6 +12,8 @@ using SPMeta2.Services.Impl; using SPMeta2.Standard.Definitions.Fields; using SPMeta2.Utils; +using SPMeta2.Regression.Utils; +using System.IO; namespace SPMeta2.Regression.Impl.Tests.Impl.Build { @@ -40,7 +42,7 @@ public BuildBaseline() [TestClass] public class BuildBaselineTests { - + [TestMethod] [TestCategory("CI.Core")] @@ -77,16 +79,21 @@ public void Create_BuildBaseline() var content = xmlService.Serialize(result); - Trace.WriteLine(content); + RegressionUtils.WriteLine(content); var paths = new[] { - fileName, - "../../../SPMeta2.Build/" + fileName + System.IO.Path.GetFullPath(fileName), + System.IO.Path.GetFullPath("../../../SPMeta2.Build/" + fileName) }; foreach (var path in paths) + { + var dirPath = Path.GetDirectoryName(path); + Directory.CreateDirectory(dirPath); + System.IO.File.WriteAllText(path, content); + } } private BuildBaseline BuildBaselineFromAssembly(Assembly assembly) @@ -106,20 +113,20 @@ private BuildBaseline BuildBaselineFromAssembly(Assembly assembly) .Select(t => t.AssemblyQualifiedName) .ToList(); - Trace.WriteLine(string.Format("AssemblyFullName:[{0}]", result.AssemblyFullName)); - Trace.WriteLine(string.Format("DefinitionTypeFullNames:[{0}]", result.DefinitionTypeFullNames.Count)); - Trace.WriteLine(string.Format("ModelHandlerTypeFullNames:[{0}]", result.ModelHandlerTypeFullNames.Count)); + RegressionUtils.WriteLine(string.Format("AssemblyFullName:[{0}]", result.AssemblyFullName)); + RegressionUtils.WriteLine(string.Format("DefinitionTypeFullNames:[{0}]", result.DefinitionTypeFullNames.Count)); + RegressionUtils.WriteLine(string.Format("ModelHandlerTypeFullNames:[{0}]", result.ModelHandlerTypeFullNames.Count)); - Trace.WriteLine("Definitions:"); + RegressionUtils.WriteLine("Definitions:"); foreach (var name in result.DefinitionTypeFullNames) - Trace.WriteLine(" " + name); + RegressionUtils.WriteLine(" " + name); - Trace.WriteLine("Model handlers:"); + RegressionUtils.WriteLine("Model handlers:"); foreach (var name in result.ModelHandlerTypeFullNames) - Trace.WriteLine(" " + name); + RegressionUtils.WriteLine(" " + name); - Trace.WriteLine(string.Empty); - Trace.WriteLine(string.Empty); + RegressionUtils.WriteLine(string.Empty); + RegressionUtils.WriteLine(string.Empty); return result; } diff --git a/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Services/Base/TokenReplacementServiceTestBase.cs b/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Services/Base/TokenReplacementServiceTestBase.cs index 2584b3d2f..c11e5d871 100644 --- a/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Services/Base/TokenReplacementServiceTestBase.cs +++ b/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Services/Base/TokenReplacementServiceTestBase.cs @@ -7,6 +7,7 @@ using Microsoft.SharePoint.Client; using SPMeta2.Services; +using SPMeta2.Regression.Utils; namespace SPMeta2.Regression.Impl.Tests.Impl.Services.Base { @@ -27,7 +28,7 @@ protected bool HasAllTestsForTokens(string methodPrefix, IEnumerable methodPrefix); var method = methods.FirstOrDefault(m => m.Name.ToUpper() == methodName.ToUpper()); - Trace.WriteLine(methodName + " : " + (method != null)); + RegressionUtils.WriteLine(methodName + " : " + (method != null)); if (method == null) isValid = false; @@ -59,7 +60,7 @@ protected bool ShouldPass(string message, object context, string token, string e { var result = true; - Trace.WriteLine(message); + RegressionUtils.WriteLine(message); var valueResult = Service.ReplaceTokens(new TokenReplacementContext { @@ -69,7 +70,7 @@ protected bool ShouldPass(string message, object context, string token, string e result = expectedUrl.ToUpper() == valueResult.Value.ToUpper(); - Trace.WriteLine(string.Format("[{0}] - [{1}] - token:[{2}] expected value:[{3}] replaced value:[{4}]", + RegressionUtils.WriteLine(string.Format("[{0}] - [{1}] - token:[{2}] expected value:[{3}] replaced value:[{4}]", new object[] { message, diff --git a/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Services/CSOM/CSOMTokenReplacementServiceTests.cs b/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Services/CSOM/CSOMTokenReplacementServiceTests.cs index e4c61aaf8..6fe5d17b5 100644 --- a/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Services/CSOM/CSOMTokenReplacementServiceTests.cs +++ b/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Services/CSOM/CSOMTokenReplacementServiceTests.cs @@ -126,6 +126,44 @@ public void CSOMTokenReplacementService_Can_Replace_Site_Token() Assert.IsTrue(isValid); } + [TestMethod] + [TestCategory("Regression.Impl.CSOMTokenReplacementService")] + public void CSOMTokenReplacementService_Should_Not_ChangeNonTokenedUrl() + { + var isValid = true; + var runner = new CSOMProvisionRunner(); + + runner.SiteUrls.ForEach(siteUrl => + { + runner.WithCSOMContext(siteUrl, context => + { + PreloadProperties(context); + + var site = context.Site; + + var originalFullUrl = site.Url; + var originalSiteRelativeUrl = site.ServerRelativeUrl; + + var originalValueResult = Service.ReplaceTokens(new TokenReplacementContext + { + Value = originalFullUrl, + Context = context + }); + + var originalSiteRelativeResult = Service.ReplaceTokens(new TokenReplacementContext + { + Value = originalSiteRelativeUrl, + Context = context + }); + + Assert.AreEqual(originalFullUrl, originalValueResult.Value); + Assert.AreEqual(originalSiteRelativeUrl, originalSiteRelativeResult.Value); + }); + }); + + Assert.IsTrue(isValid); + } + [TestMethod] [TestCategory("Regression.Impl.CSOMTokenReplacementService")] public void CSOMTokenReplacementService_Should_Support_ClientContext() @@ -218,12 +256,24 @@ private static void PreloadProperties(ClientContext clientContext) needQuery = true; } + if (!clientContext.Site.IsPropertyAvailable("Url")) + { + clientContext.Load(clientContext.Site, s => s.Url); + needQuery = true; + } + if (!clientContext.Web.IsPropertyAvailable("ServerRelativeUrl")) { clientContext.Load(clientContext.Web, w => w.ServerRelativeUrl); needQuery = true; } + if (!clientContext.Web.IsPropertyAvailable("Url")) + { + clientContext.Load(clientContext.Web, w => w.Url); + needQuery = true; + } + if (needQuery) { clientContext.ExecuteQueryWithTrace(); diff --git a/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Services/SSOM/SSOMTokenReplacementServiceTests.cs b/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Services/SSOM/SSOMTokenReplacementServiceTests.cs index 12c650f53..1aa171ed8 100644 --- a/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Services/SSOM/SSOMTokenReplacementServiceTests.cs +++ b/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Services/SSOM/SSOMTokenReplacementServiceTests.cs @@ -149,6 +149,40 @@ public void SSOMTokenReplacementService_Can_Replace_Site_Token() Assert.IsTrue(isValid); } + [TestMethod] + [TestCategory("Regression.Impl.SSOMTokenReplacementService")] + public void SSOMTokenReplacementService_Should_Not_ChangeNonTokenedUrl() + { + var isValid = true; + var runner = new SSOMProvisionRunner(); + + runner.SiteUrls.ForEach(siteUrl => + { + runner.WithSSOMSiteAndWebContext(siteUrl, (site, web) => + { + var originalFullUrl = site.Url; + var originalSiteRelativeUrl = site.ServerRelativeUrl; + + var originalValueResult = Service.ReplaceTokens(new TokenReplacementContext + { + Value = originalFullUrl, + Context = site + }); + + var originalSiteRelativeResult = Service.ReplaceTokens(new TokenReplacementContext + { + Value = originalSiteRelativeUrl, + Context = site + }); + + Assert.AreEqual(originalFullUrl, originalValueResult.Value); + Assert.AreEqual(originalSiteRelativeUrl, originalSiteRelativeResult.Value); + }); + }); + + Assert.IsTrue(isValid); + } + #endregion } } diff --git a/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Services/ValidationServiceTests.cs b/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Services/ValidationServiceTests.cs index 6c8ba48c5..04c8ddaf6 100644 --- a/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Services/ValidationServiceTests.cs +++ b/SPMeta2/SPMeta2.Regression.Impl.Tests/Impl/Services/ValidationServiceTests.cs @@ -9,7 +9,8 @@ using SPMeta2.Services.Impl.Validation; using SPMeta2.SSOM.Services; using SPMeta2.SSOM.Standard.Services; -using SPMeta2.Utils; +using SPMeta2.Utils; +using SPMeta2.Regression.Utils; namespace SPMeta2.Regression.Impl.Tests.Impl.Services { @@ -48,10 +49,10 @@ public void All_Services_Should_Have_Metadata() foreach (var validationServiceType in validationServiceTypes) { - var service = Activator.CreateInstance(validationServiceType) as PreDeploymentValidationServiceBase; - - Trace.WriteLine(service.Title); - Trace.WriteLine(service.Description); + var service = Activator.CreateInstance(validationServiceType) as PreDeploymentValidationServiceBase; + + RegressionUtils.WriteLine(service.Title); + RegressionUtils.WriteLine(service.Description); Assert.IsNotNull(service); diff --git a/SPMeta2/SPMeta2.Regression.Impl.Tests/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.Regression.Impl.Tests/Properties/AssemblyInfo.cs index d4b011d59..9170ec3f7 100644 --- a/SPMeta2/SPMeta2.Regression.Impl.Tests/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2.Regression.Impl.Tests/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.2.17040.0900")] +[assembly: AssemblyFileVersion("1.2.17057.1048")] diff --git a/SPMeta2/SPMeta2.Regression.Impl.Tests/SPMeta2.Regression.Impl.Tests.csproj b/SPMeta2/SPMeta2.Regression.Impl.Tests/SPMeta2.Regression.Impl.Tests.csproj index 41814ae77..567d385b6 100644 --- a/SPMeta2/SPMeta2.Regression.Impl.Tests/SPMeta2.Regression.Impl.Tests.csproj +++ b/SPMeta2/SPMeta2.Regression.Impl.Tests/SPMeta2.Regression.Impl.Tests.csproj @@ -269,6 +269,10 @@ {2DA71A5B-C039-4A2E-9985-91D6501F293C} SPMeta2.Regression.Tests + + {0de538c9-1723-46b1-90f8-5dc67c56d7dd} + SPMeta2.Regression + {7D095A0D-0BDE-446D-8093-13E5685F1D3C} SPMeta2.SSOM.Standard diff --git a/SPMeta2/SPMeta2.Regression.SSOM.Standard/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.Regression.SSOM.Standard/Properties/AssemblyInfo.cs index 424557333..1ea95bb8c 100644 --- a/SPMeta2/SPMeta2.Regression.SSOM.Standard/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2.Regression.SSOM.Standard/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.2.17040.0900")] +[assembly: AssemblyFileVersion("1.2.17057.1048")] diff --git a/SPMeta2/SPMeta2.Regression.SSOM/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.Regression.SSOM/Properties/AssemblyInfo.cs index 679745665..f6df0545c 100644 --- a/SPMeta2/SPMeta2.Regression.SSOM/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2.Regression.SSOM/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.2.17040.0900")] +[assembly: AssemblyFileVersion("1.2.17057.1048")] diff --git a/SPMeta2/SPMeta2.Regression.SSOM/Validation/Extended/WebpartPresenceOnPageDefinitionValidator.cs b/SPMeta2/SPMeta2.Regression.SSOM/Validation/Extended/WebpartPresenceOnPageDefinitionValidator.cs index 13aa8a42c..12e714841 100644 --- a/SPMeta2/SPMeta2.Regression.SSOM/Validation/Extended/WebpartPresenceOnPageDefinitionValidator.cs +++ b/SPMeta2/SPMeta2.Regression.SSOM/Validation/Extended/WebpartPresenceOnPageDefinitionValidator.cs @@ -44,7 +44,7 @@ DefinitionBase definitionBase var isValid = true; - TraceUtils.WithScope(trace => + IndentableTrace.WithScope(trace => { trace.WriteLine(string.Format("Checking web part presence on the page:[{0}]", pageUrl)); diff --git a/SPMeta2/SPMeta2.Regression.SSOM/Validation/Extended/XsltListViewWebPartGridModePresenceValidator.cs b/SPMeta2/SPMeta2.Regression.SSOM/Validation/Extended/XsltListViewWebPartGridModePresenceValidator.cs index 45f76d5ad..70e1691d9 100644 --- a/SPMeta2/SPMeta2.Regression.SSOM/Validation/Extended/XsltListViewWebPartGridModePresenceValidator.cs +++ b/SPMeta2/SPMeta2.Regression.SSOM/Validation/Extended/XsltListViewWebPartGridModePresenceValidator.cs @@ -33,7 +33,7 @@ protected override void ValidateHtmlPage(SPFile file, string pageUrl, string pag var isValid = true; - TraceUtils.WithScope(trace => + IndentableTrace.WithScope(trace => { trace.WriteLine(string.Format("Checking InitGridFromView presence:[{0}]", pageUrl)); diff --git a/SPMeta2/SPMeta2.Regression.SSOM/Validation/Fields/CalculatedFieldDefinitionValidator.cs b/SPMeta2/SPMeta2.Regression.SSOM/Validation/Fields/CalculatedFieldDefinitionValidator.cs index f508e886e..fd36ab75a 100644 --- a/SPMeta2/SPMeta2.Regression.SSOM/Validation/Fields/CalculatedFieldDefinitionValidator.cs +++ b/SPMeta2/SPMeta2.Regression.SSOM/Validation/Fields/CalculatedFieldDefinitionValidator.cs @@ -50,7 +50,7 @@ public override void DeployModel(object modelHost, DefinitionBase model) else typedFieldAssert.SkipProperty(m => m.Formula); - TraceUtils.WithScope(s => + IndentableTrace.WithScope(s => { s.WriteLine(string.Format("Formula: Src:[{0}] Dst:[{1}]", typedDefinition.Formula, typedField.Formula)); }); diff --git a/SPMeta2/SPMeta2.Regression.SSOM/Validation/ListViewDefinitionValidator.cs b/SPMeta2/SPMeta2.Regression.SSOM/Validation/ListViewDefinitionValidator.cs index 736ad0090..d1b6129f5 100644 --- a/SPMeta2/SPMeta2.Regression.SSOM/Validation/ListViewDefinitionValidator.cs +++ b/SPMeta2/SPMeta2.Regression.SSOM/Validation/ListViewDefinitionValidator.cs @@ -1,322 +1,394 @@ -using System.Linq; -using System.Xml.Linq; - -using Microsoft.SharePoint; - -using SPMeta2.Containers.Assertion; -using SPMeta2.Definitions; -using SPMeta2.Regression.SSOM.Extensions; -using SPMeta2.SSOM.Extensions; -using SPMeta2.SSOM.ModelHandlers; -using SPMeta2.Utils; +using System.Linq; +using System.Xml.Linq; + +using Microsoft.SharePoint; + +using SPMeta2.Containers.Assertion; +using SPMeta2.Definitions; +using SPMeta2.Regression.SSOM.Extensions; +using SPMeta2.SSOM.Extensions; +using SPMeta2.SSOM.ModelHandlers; +using SPMeta2.Utils; using SPMeta2.SSOM.ModelHosts; -using System.Text.RegularExpressions; - -namespace SPMeta2.Regression.SSOM.Validation -{ - public class ListViewDefinitionValidator : ListViewModelHandler - { - public override void DeployModel(object modelHost, DefinitionBase model) - { - var listModelHost = modelHost.WithAssertAndCast("modelHost", value => value.RequireNotNull()); - var definition = model.WithAssertAndCast("model", value => value.RequireNotNull()); - - var list = listModelHost.HostList; - var spObject = list.Views.FindByName(definition.Title); - - var assert = ServiceFactory.AssertService - .NewAssert(definition, spObject) - .ShouldBeEqual(m => m.Title, o => o.Title) - .ShouldBeEqual(m => m.IsDefault, o => o.IsDefaul()) - .ShouldBeEqual(m => m.Hidden, o => o.Hidden) - .ShouldBeEqual(m => m.RowLimit, o => (int)o.RowLimit) - .ShouldBeEqual(m => m.IsPaged, o => o.Paged); - - - if (definition.InlineEdit.HasValue) - assert.ShouldBeEqual(m => m.InlineEdit.ToString().ToLower(), o => o.InlineEdit.ToLower()); - else - assert.SkipProperty(m => m.InlineEdit); - - - if (!string.IsNullOrEmpty(definition.Scope)) - { - assert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(def => def.Scope); - var dstProp = d.GetExpressionValue(o => o.Scope); - - var scopeValue = ListViewScopeTypesConvertService.NormilizeValueToSSOMType(definition.Scope); - - var isValid = scopeValue == d.Scope.ToString(); - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = dstProp, - IsValid = isValid - }; - }); - } - else - { - assert.SkipProperty(m => m.Scope); - } - - if (!string.IsNullOrEmpty(definition.Query)) - { - assert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(def => def.Query); - var dstProp = d.GetExpressionValue(o => o.Query); - - var srcViewDate = assert.Src.Query.Replace(System.Environment.NewLine, string.Empty).Replace(" /", "/"); +using System.Text.RegularExpressions; +using System; + +namespace SPMeta2.Regression.SSOM.Validation +{ + public class ListViewDefinitionValidator : ListViewModelHandler + { + public override void DeployModel(object modelHost, DefinitionBase model) + { + var listModelHost = modelHost.WithAssertAndCast("modelHost", value => value.RequireNotNull()); + var definition = model.WithAssertAndCast("model", value => value.RequireNotNull()); + + var list = listModelHost.HostList; + var spObject = list.Views.FindByName(definition.Title); + + var assert = ServiceFactory.AssertService + .NewAssert(definition, spObject) + .ShouldBeEqual(m => m.Title, o => o.Title) + .ShouldBeEqual(m => m.IsDefault, o => o.IsDefaul()) + .ShouldBeEqual(m => m.Hidden, o => o.Hidden) + .ShouldBeEqual(m => m.RowLimit, o => (int)o.RowLimit) + .ShouldBeEqual(m => m.IsPaged, o => o.Paged); + + + if (definition.InlineEdit.HasValue) + assert.ShouldBeEqual(m => m.InlineEdit.ToString().ToLower(), o => o.InlineEdit.ToLower()); + else + assert.SkipProperty(m => m.InlineEdit); + + + if (!string.IsNullOrEmpty(definition.Scope)) + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.Scope); + var dstProp = d.GetExpressionValue(o => o.Scope); + + var scopeValue = ListViewScopeTypesConvertService.NormilizeValueToSSOMType(definition.Scope); + + var isValid = scopeValue == d.Scope.ToString(); + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = dstProp, + IsValid = isValid + }; + }); + } + else + { + assert.SkipProperty(m => m.Scope); + } + + if (!string.IsNullOrEmpty(definition.Query)) + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.Query); + var dstProp = d.GetExpressionValue(o => o.Query); + + var srcViewDate = assert.Src.Query.Replace(System.Environment.NewLine, string.Empty).Replace(" /", "/"); var dstViewDate = assert.Dst.Query.Replace(System.Environment.NewLine, string.Empty).Replace(" /", "/"); srcViewDate = Regex.Replace(srcViewDate, @"\r\n?|\n", string.Empty); - dstViewDate = Regex.Replace(dstViewDate, @"\r\n?|\n", string.Empty); - - - var isValid = srcViewDate.ToUpper() == dstViewDate.ToUpper(); - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = dstProp, - IsValid = isValid - }; - }); - } - else - assert.SkipProperty(m => m.Query); - - - if (!string.IsNullOrEmpty(definition.ViewData)) - { - assert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(def => def.ViewData); - var dstProp = d.GetExpressionValue(o => o.ViewData); - - var srcViewDate = assert.Src.ViewData.Replace(System.Environment.NewLine, string.Empty).Replace(" /", "/"); + dstViewDate = Regex.Replace(dstViewDate, @"\r\n?|\n", string.Empty); + + + var isValid = srcViewDate.ToUpper() == dstViewDate.ToUpper(); + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = dstProp, + IsValid = isValid + }; + }); + } + else + assert.SkipProperty(m => m.Query); + + + if (!string.IsNullOrEmpty(definition.ViewData)) + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.ViewData); + var dstProp = d.GetExpressionValue(o => o.ViewData); + + var srcViewDate = assert.Src.ViewData.Replace(System.Environment.NewLine, string.Empty).Replace(" /", "/"); var dstViewDate = assert.Dst.ViewData.Replace(System.Environment.NewLine, string.Empty).Replace(" /", "/"); srcViewDate = Regex.Replace(srcViewDate, @"\r\n?|\n", string.Empty); - dstViewDate = Regex.Replace(dstViewDate, @"\r\n?|\n", string.Empty); - - var isValid = srcViewDate.ToUpper() == dstViewDate.ToUpper(); - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = dstProp, - IsValid = isValid - }; - }); - } - else - assert.SkipProperty(m => m.ViewData); - - if (!string.IsNullOrEmpty(definition.Type)) - { - assert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(def => def.Type); - var dstProp = d.GetExpressionValue(o => o.Type); - - var isValid = srcProp.Value.ToString().ToUpper() == - dstProp.Value.ToString().ToUpper(); - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = dstProp, - IsValid = isValid - }; - }); - } - else - assert.SkipProperty(m => m.Type); - - if (definition.ViewStyleId.HasValue) - { - assert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(def => def.ViewStyleId); - - var isValid = false; - - var srcViewId = s.ViewStyleId; - var destViewId = 0; - - var doc = XDocument.Parse(d.SchemaXml); - destViewId = ConvertUtils.ToInt(doc.Descendants("ViewStyle") - .First() - .GetAttributeValue("ID") - ).Value; - - isValid = srcViewId == destViewId; - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = null, - IsValid = isValid - }; - }); - } - else - assert.SkipProperty(m => m.ViewStyleId, "ViewStyleId is null"); - - if (!string.IsNullOrEmpty(definition.JSLink)) - assert.ShouldBeEqual(m => m.JSLink, o => o.JSLink); - else - assert.SkipProperty(m => m.JSLink); - - if (definition.DefaultViewForContentType.HasValue) - assert.ShouldBeEqual(m => m.DefaultViewForContentType, o => o.DefaultViewForContentType); - else - assert.SkipProperty(m => m.DefaultViewForContentType, "DefaultViewForContentType is null or empty. Skipping."); - - if (definition.TabularView.HasValue) - assert.ShouldBeEqual(m => m.TabularView, o => o.TabularView); - else + dstViewDate = Regex.Replace(dstViewDate, @"\r\n?|\n", string.Empty); + + var isValid = srcViewDate.ToUpper() == dstViewDate.ToUpper(); + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = dstProp, + IsValid = isValid + }; + }); + } + else + assert.SkipProperty(m => m.ViewData); + + if (definition.Types.Count() == 0) + { + assert.SkipProperty(m => m.Types, "Types.Count == 0"); + + if (!string.IsNullOrEmpty(definition.Type)) + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.Type); + var dstProp = d.GetExpressionValue(o => o.Type); + + var isValid = srcProp.Value.ToString().ToUpper() == + dstProp.Value.ToString().ToUpper(); + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = dstProp, + IsValid = isValid + }; + }); + } + else + assert.SkipProperty(m => m.Type); + } + else + { + assert.SkipProperty(m => m.Type, "Types.Count != 0"); + + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.Types); + var dstProp = d.GetExpressionValue(o => o.Type); + + var isValid = false; + + SPViewCollection.SPViewType? srcType = null; + + foreach (var type in s.Types) + { + var tmpViewType = (SPViewCollection.SPViewType)Enum.Parse(typeof(SPViewCollection.SPViewType), type); + + if (srcType == null) + srcType = tmpViewType; + else + srcType = srcType | tmpViewType; + } + + var srcTypeValue = (int)srcType; + var dstTypeValue = (int)0; + + // checking if only reccurence set + // test designed that way only + if (((int)srcTypeValue & (int)(SPViewCollection.SPViewType.Recurrence)) == + (int)SPViewCollection.SPViewType.Recurrence) + { + isValid = d.RecurrenceRowset; + } + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = dstProp, + IsValid = isValid + }; + }); + } + + if (definition.ViewStyleId.HasValue) + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.ViewStyleId); + + var isValid = false; + + var srcViewId = s.ViewStyleId; + var destViewId = 0; + + var doc = XDocument.Parse(d.SchemaXml); + destViewId = ConvertUtils.ToInt(doc.Descendants("ViewStyle") + .First() + .GetAttributeValue("ID") + ).Value; + + isValid = srcViewId == destViewId; + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = null, + IsValid = isValid + }; + }); + } + else + assert.SkipProperty(m => m.ViewStyleId, "ViewStyleId is null"); + + if (!string.IsNullOrEmpty(definition.JSLink)) + assert.ShouldBeEqual(m => m.JSLink, o => o.JSLink); + else + assert.SkipProperty(m => m.JSLink); + + if (definition.DefaultViewForContentType.HasValue) + assert.ShouldBeEqual(m => m.DefaultViewForContentType, o => o.DefaultViewForContentType); + else + assert.SkipProperty(m => m.DefaultViewForContentType, "DefaultViewForContentType is null or empty. Skipping."); + + if (definition.TabularView.HasValue) + assert.ShouldBeEqual(m => m.TabularView, o => o.TabularView); + else assert.SkipProperty(m => m.TabularView, "TabularView is null or empty. Skipping."); if (definition.IncludeRootFolder.HasValue) assert.ShouldBeEqual(m => m.IncludeRootFolder, o => o.IncludeRootFolder); else - assert.SkipProperty(m => m.IncludeRootFolder, "IncludeRootFolder is null or empty. Skipping."); - - if (string.IsNullOrEmpty(definition.ContentTypeName)) - assert.SkipProperty(m => m.ContentTypeName, "ContentTypeName is null or empty. Skipping."); - else - { - var contentTypeId = LookupListContentTypeByName(list, definition.ContentTypeName); - - assert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(def => def.ContentTypeName); - var dstProp = d.GetExpressionValue(ct => ct.ContentTypeId); - - var isValis = contentTypeId == d.ContentTypeId; - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = dstProp, - IsValid = isValis - }; - }); - } - - if (string.IsNullOrEmpty(definition.ContentTypeId)) - assert.SkipProperty(m => m.ContentTypeId, "ContentTypeId is null or empty. Skipping."); - else - { - var contentTypeId = LookupListContentTypeById(list, definition.ContentTypeId); - - assert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(def => def.ContentTypeId); - var dstProp = d.GetExpressionValue(ct => ct.ContentTypeId); - - var isValis = contentTypeId == d.ContentTypeId; - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = dstProp, - IsValid = isValis - }; - }); - } - - if (string.IsNullOrEmpty(definition.AggregationsStatus)) - assert.SkipProperty(m => m.AggregationsStatus, "Aggregationsstatus is null or empty. Skipping."); - else - assert.ShouldBeEqual(m => m.AggregationsStatus, o => o.AggregationsStatus); - - if (string.IsNullOrEmpty(definition.Aggregations)) - assert.SkipProperty(m => m.Aggregations, "Aggregations is null or empty. Skipping."); - else - assert.ShouldBeEqual(m => m.Aggregations, o => o.Aggregations); - - if (string.IsNullOrEmpty(definition.Url)) - assert.SkipProperty(m => m.Url, "Url is null or empty. Skipping."); - else - assert.ShouldBePartOf(m => m.Url, o => o.ServerRelativeUrl); - - assert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(def => def.Fields); - var dstProp = d.GetExpressionValue(ct => ct.ViewFields); - - var hasAllFields = true; - - foreach (var srcField in s.Fields) - { - var listField = d.ParentList.Fields.OfType().FirstOrDefault(f => f.StaticName == srcField); - - // if list-scoped field we need to check by internal name - // internal name is changed for list scoped-fields - // that's why to check by BOTH, definition AND real internal name - - if (!d.ViewFields.ToStringCollection().Contains(srcField) && - !d.ViewFields.ToStringCollection().Contains(listField.InternalName)) - hasAllFields = false; - } - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = dstProp, - IsValid = hasAllFields - }; - }); - - /// localization - if (definition.TitleResource.Any()) - { - assert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(def => def.TitleResource); - var isValid = true; - - foreach (var userResource in s.TitleResource) - { - var culture = LocalizationService.GetUserResourceCultureInfo(userResource); - var value = d.TitleResource.GetValueForUICulture(culture); - - isValid = userResource.Value == value; - - if (!isValid) - break; - } - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = null, - IsValid = isValid - }; - }); - } - else - { - assert.SkipProperty(m => m.TitleResource, "TitleResource is NULL or empty. Skipping."); - } - - } - } - -} + assert.SkipProperty(m => m.IncludeRootFolder, "IncludeRootFolder is null or empty. Skipping."); + + if (string.IsNullOrEmpty(definition.ContentTypeName)) + assert.SkipProperty(m => m.ContentTypeName, "ContentTypeName is null or empty. Skipping."); + else + { + var contentTypeId = LookupListContentTypeByName(list, definition.ContentTypeName); + + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.ContentTypeName); + var dstProp = d.GetExpressionValue(ct => ct.ContentTypeId); + + var isValis = contentTypeId == d.ContentTypeId; + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = dstProp, + IsValid = isValis + }; + }); + } + + if (string.IsNullOrEmpty(definition.ContentTypeId)) + assert.SkipProperty(m => m.ContentTypeId, "ContentTypeId is null or empty. Skipping."); + else + { + var contentTypeId = LookupListContentTypeById(list, definition.ContentTypeId); + + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.ContentTypeId); + var dstProp = d.GetExpressionValue(ct => ct.ContentTypeId); + + var isValis = contentTypeId == d.ContentTypeId; + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = dstProp, + IsValid = isValis + }; + }); + } + + if (string.IsNullOrEmpty(definition.AggregationsStatus)) + assert.SkipProperty(m => m.AggregationsStatus, "Aggregationsstatus is null or empty. Skipping."); + else + assert.ShouldBeEqual(m => m.AggregationsStatus, o => o.AggregationsStatus); + + if (string.IsNullOrEmpty(definition.Aggregations)) + assert.SkipProperty(m => m.Aggregations, "Aggregations is null or empty. Skipping."); + else + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.Aggregations); + var dstProp = d.GetExpressionValue(ct => ct.Aggregations); + + var isValid = s.Aggregations + .Replace("'", string.Empty) + .Replace(" ", string.Empty) + .Replace("\"", string.Empty) == + d.Aggregations + .Replace("'", string.Empty) + .Replace(" ", string.Empty) + .Replace("\"", string.Empty); + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = dstProp, + IsValid = isValid + }; + }); + } + + if (string.IsNullOrEmpty(definition.Url)) + assert.SkipProperty(m => m.Url, "Url is null or empty. Skipping."); + else + assert.ShouldBePartOf(m => m.Url, o => o.ServerRelativeUrl); + + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.Fields); + var dstProp = d.GetExpressionValue(ct => ct.ViewFields); + + var hasAllFields = true; + + foreach (var srcField in s.Fields) + { + var listField = d.ParentList.Fields.OfType().FirstOrDefault(f => f.StaticName == srcField); + + // if list-scoped field we need to check by internal name + // internal name is changed for list scoped-fields + // that's why to check by BOTH, definition AND real internal name + + if (!d.ViewFields.ToStringCollection().Contains(srcField) && + !d.ViewFields.ToStringCollection().Contains(listField.InternalName)) + hasAllFields = false; + } + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = dstProp, + IsValid = hasAllFields + }; + }); + + /// localization + if (definition.TitleResource.Any()) + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.TitleResource); + var isValid = true; + + foreach (var userResource in s.TitleResource) + { + var culture = LocalizationService.GetUserResourceCultureInfo(userResource); + var value = d.TitleResource.GetValueForUICulture(culture); + + isValid = userResource.Value == value; + + if (!isValid) + break; + } + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = null, + IsValid = isValid + }; + }); + } + else + { + assert.SkipProperty(m => m.TitleResource, "TitleResource is NULL or empty. Skipping."); + } + + } + } + +} diff --git a/SPMeta2/SPMeta2.Regression.SSOM/Validation/SP2013WorkflowDefinitionValidator.cs b/SPMeta2/SPMeta2.Regression.SSOM/Validation/SP2013WorkflowDefinitionValidator.cs index 232bc1916..f98334788 100644 --- a/SPMeta2/SPMeta2.Regression.SSOM/Validation/SP2013WorkflowDefinitionValidator.cs +++ b/SPMeta2/SPMeta2.Regression.SSOM/Validation/SP2013WorkflowDefinitionValidator.cs @@ -1,34 +1,81 @@ -using SPMeta2.Definitions; -using SPMeta2.Definitions.Base; -using SPMeta2.SSOM.ModelHandlers; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using SPMeta2.SSOM.ModelHosts; -using SPMeta2.Utils; - -namespace SPMeta2.Regression.SSOM.Validation -{ - public class SP2013WorkflowDefinitionValidator : SP2013WorkflowDefinitionHandler - { - public override void DeployModel(object modelHost, DefinitionBase model) - { - var webModelHost = modelHost.WithAssertAndCast("modelHost", value => value.RequireNotNull()); - var definition = model.WithAssertAndCast("model", value => value.RequireNotNull()); - - var spObject = GetCurrentWorkflowDefinition(webModelHost.HostWeb, definition); - - var assert = ServiceFactory.AssertService - .NewAssert(definition, spObject) - .ShouldNotBeNull(spObject) - .SkipProperty(m => m.Override, "Override is not supported yet.") - .ShouldBeEqual(m => m.Xaml, o => o.Xaml) - .ShouldBeEqual(m => m.DisplayName, o => o.DisplayName); - - - // TODO, check Override later - } - } -} +using SPMeta2.Definitions; +using SPMeta2.Definitions.Base; +using SPMeta2.SSOM.ModelHandlers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using SPMeta2.SSOM.ModelHosts; +using SPMeta2.Utils; +using SPMeta2.Containers.Assertion; + +namespace SPMeta2.Regression.SSOM.Validation +{ + public class SP2013WorkflowDefinitionValidator : SP2013WorkflowDefinitionHandler + { + public override void DeployModel(object modelHost, DefinitionBase model) + { + var webModelHost = modelHost.WithAssertAndCast("modelHost", value => value.RequireNotNull()); + var definition = model.WithAssertAndCast("model", value => value.RequireNotNull()); + + var spObject = GetCurrentWorkflowDefinition(webModelHost.HostWeb, definition); + + var assert = ServiceFactory.AssertService + .NewAssert(definition, spObject) + .ShouldNotBeNull(spObject) + .SkipProperty(m => m.Override, "Override is not supported yet.") + .ShouldBeEqual(m => m.Xaml, o => o.Xaml) + .ShouldBeEqual(m => m.DisplayName, o => o.DisplayName); + + if (!string.IsNullOrEmpty(definition.RestrictToScope)) + assert.ShouldBeEqual(m => m.RestrictToScope, o => o.RestrictToScope); + else + assert.SkipProperty(p => p.RestrictToScope); + + if (!string.IsNullOrEmpty(definition.RestrictToType)) + assert.ShouldBeEqual(m => m.RestrictToType, o => o.RestrictToType); + else + assert.SkipProperty(p => p.RestrictToType); + + if (definition.Properties.Count() > 0) + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.Properties); + var dstProp = d.GetExpressionValue(ct => ct.Properties); + + var isValid = true; + + foreach (var prop in s.Properties) + { + var propName = prop.Name; + var propValue = prop.Value; + + if (!d.Properties.ContainsKey(propName)) + { + isValid = false; + } + + if (d.Properties[propName] != propValue) + { + isValid = false; + } + } + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = dstProp, + IsValid = isValid + }; + }); + } + else + { + assert.SkipProperty(p => p.Properties, ".Properties.Count() = 0. Skipping"); + } + } + } +} diff --git a/SPMeta2/SPMeta2.Regression.SSOM/Validation/SP2013WorkflowSubscriptionDefinitionValidator.cs b/SPMeta2/SPMeta2.Regression.SSOM/Validation/SP2013WorkflowSubscriptionDefinitionValidator.cs index eaa4ae117..1647d5bdf 100644 --- a/SPMeta2/SPMeta2.Regression.SSOM/Validation/SP2013WorkflowSubscriptionDefinitionValidator.cs +++ b/SPMeta2/SPMeta2.Regression.SSOM/Validation/SP2013WorkflowSubscriptionDefinitionValidator.cs @@ -147,7 +147,46 @@ private void ValidateWorkflowSubscription(object modelHost, }; }); - #endregion + #endregion + + if (definition.Properties.Count() > 0) + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.Properties); + var dstProp = d.GetExpressionValue(ct => ct.PropertyDefinitions); + + var isValid = true; + + foreach (var prop in s.Properties) + { + var propName = prop.Name; + var propValue = prop.Value; + + if (!d.PropertyDefinitions.ContainsKey(propName)) + { + isValid = false; + } + + if (d.PropertyDefinitions[propName] != propValue) + { + isValid = false; + } + } + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = dstProp, + IsValid = isValid + }; + }); + } + else + { + assert.SkipProperty(p => p.Properties, ".Properties.Count() = 0. Skipping"); + } #endregion } diff --git a/SPMeta2/SPMeta2.Regression.SSOM/Validation/WebDefinitionValidator.cs b/SPMeta2/SPMeta2.Regression.SSOM/Validation/WebDefinitionValidator.cs index 9091562c0..1b369c975 100644 --- a/SPMeta2/SPMeta2.Regression.SSOM/Validation/WebDefinitionValidator.cs +++ b/SPMeta2/SPMeta2.Regression.SSOM/Validation/WebDefinitionValidator.cs @@ -1,180 +1,185 @@ -using System.Linq; - -using Microsoft.SharePoint; - -using SPMeta2.Containers.Assertion; -using SPMeta2.Definitions; -using SPMeta2.Regression.SSOM.Extensions; -using SPMeta2.SSOM.ModelHandlers; -using SPMeta2.SSOM.ModelHosts; -using SPMeta2.Utils; - -namespace SPMeta2.Regression.SSOM.Validation -{ - public class WebDefinitionValidator : WebModelHandler - { - public override void DeployModel(object modelHost, DefinitionBase model) - { - var definition = model.WithAssertAndCast("model", value => value.RequireNotNull()); - SPWeb parentWeb = null; - - if (modelHost is SiteModelHost) - parentWeb = (modelHost as SiteModelHost).HostSite.RootWeb; - - if (modelHost is WebModelHost) - parentWeb = (modelHost as WebModelHost).HostWeb; - +using System.Linq; + +using Microsoft.SharePoint; + +using SPMeta2.Containers.Assertion; +using SPMeta2.Definitions; +using SPMeta2.Regression.SSOM.Extensions; +using SPMeta2.SSOM.ModelHandlers; +using SPMeta2.SSOM.ModelHosts; +using SPMeta2.Utils; + +namespace SPMeta2.Regression.SSOM.Validation +{ + public class WebDefinitionValidator : WebModelHandler + { + public override void DeployModel(object modelHost, DefinitionBase model) + { + var definition = model.WithAssertAndCast("model", value => value.RequireNotNull()); + SPWeb parentWeb = null; + + if (modelHost is SiteModelHost) + parentWeb = (modelHost as SiteModelHost).HostSite.RootWeb; + + if (modelHost is WebModelHost) + parentWeb = (modelHost as WebModelHost).HostWeb; + var spObject = GetWeb(parentWeb, definition); var assert = ServiceFactory.AssertService - .NewAssert(definition, spObject) - .ShouldBeEqual(m => m.LCID, o => o.GetLCID()); - //.ShouldBeEqual(m => m.WebTemplate, o => o.GetWebTemplate()) + .NewAssert(definition, spObject) + .ShouldBeEqual(m => m.LCID, o => o.GetLCID()); + //.ShouldBeEqual(m => m.WebTemplate, o => o.GetWebTemplate()) // temporarily switch culture to allow setting of the properties Title and Description for multi-language scenarios CultureUtils.WithCulture(spObject.UICulture, () => { - assert.ShouldBeEqual(m => m.Title, o => o.Title) + assert.ShouldBeEqual(m => m.Title, o => o.Title) .ShouldBeEqual(m => m.UseUniquePermission, o => o.HasUniqueRoleAssignments); - }); - - if (!string.IsNullOrEmpty(definition.WebTemplate)) - { - assert.ShouldBeEqual(m => m.WebTemplate, o => o.GetWebTemplate()); - assert.SkipProperty(m => m.CustomWebTemplate); - } - else - { - // no sense to chek custom web template - assert.SkipProperty(m => m.WebTemplate); - assert.SkipProperty(m => m.CustomWebTemplate); - } - - if (!string.IsNullOrEmpty(definition.AlternateCssUrl)) - assert.ShouldBeEndOf(m => m.AlternateCssUrl, o => o.AlternateCssUrl); - else - assert.SkipProperty(m => m.AlternateCssUrl); - - if (!string.IsNullOrEmpty(definition.SiteLogoUrl)) - assert.ShouldBeEndOf(m => m.SiteLogoUrl, o => o.SiteLogoUrl); - else - assert.SkipProperty(m => m.SiteLogoUrl); - - if (!string.IsNullOrEmpty(definition.Description)) - assert.ShouldBeEqual(m => m.Description, o => o.Description); - else - assert.SkipProperty(m => m.Description); - - assert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(def => def.Url); - var dstProp = d.GetExpressionValue(ct => ct.Url); - - var srcUrl = s.Url; - var dstUrl = d.Url; - - srcUrl = UrlUtility.RemoveStartingSlash(srcUrl); - - var dstSubUrl = dstUrl.Replace(parentWeb.Url + "/", string.Empty); - var isValid = srcUrl.ToUpper() == dstSubUrl.ToUpper(); - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = dstProp, - IsValid = isValid - }; - }); - - // localization - if (definition.TitleResource.Any()) - { - assert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(def => def.TitleResource); - var isValid = true; - - foreach (var userResource in s.TitleResource) - { - var culture = LocalizationService.GetUserResourceCultureInfo(userResource); - var value = d.TitleResource.GetValueForUICulture(culture); - - isValid = userResource.Value == value; - - if (!isValid) - break; - } - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = null, - IsValid = isValid - }; - }); - } - else - { - assert.SkipProperty(m => m.TitleResource, "TitleResource is NULL or empty. Skipping."); - } - - if (definition.DescriptionResource.Any()) - { - assert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(def => def.DescriptionResource); - var isValid = true; - - foreach (var userResource in s.DescriptionResource) - { - var culture = LocalizationService.GetUserResourceCultureInfo(userResource); - var value = d.DescriptionResource.GetValueForUICulture(culture); - - isValid = userResource.Value == value; - - if (!isValid) - break; - } - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = null, - IsValid = isValid - }; - }); - } - else - { - assert.SkipProperty(m => m.DescriptionResource, "DescriptionResource is NULL or empty. Skipping."); - } - - if (definition.IndexedPropertyKeys.Any()) - { - assert.ShouldBeEqual((p, s, d) => - { - var srcProp = s.GetExpressionValue(def => def.IndexedPropertyKeys); - - // Search if any indexPropertyKey from definition is not in WebModel - var differentKeys = s.IndexedPropertyKeys.Select(o => o.Name) - .Except(d.IndexedPropertyKeys); - - var isValid = !differentKeys.Any(); - - return new PropertyValidationResult - { - Tag = p.Tag, - Src = srcProp, - Dst = null, - IsValid = isValid - }; - }); - } - else - assert.SkipProperty(m => m.IndexedPropertyKeys, "IndexedPropertyKeys is NULL or empty. Skipping."); - } - } -} + }); + + if (!string.IsNullOrEmpty(definition.WebTemplate)) + { + assert.ShouldBeEqual(m => m.WebTemplate, o => o.GetWebTemplate()); + assert.SkipProperty(m => m.CustomWebTemplate); + } + else + { + // no sense to chek custom web template + assert.SkipProperty(m => m.WebTemplate); + assert.SkipProperty(m => m.CustomWebTemplate); + } + + if (!string.IsNullOrEmpty(definition.AlternateCssUrl)) + assert.ShouldBeEndOf(m => m.AlternateCssUrl, o => o.AlternateCssUrl); + else + assert.SkipProperty(m => m.AlternateCssUrl); + + if (!string.IsNullOrEmpty(definition.SiteLogoUrl)) + assert.ShouldBeEndOf(m => m.SiteLogoUrl, o => o.SiteLogoUrl); + else + assert.SkipProperty(m => m.SiteLogoUrl); + + if (!string.IsNullOrEmpty(definition.Description)) + assert.ShouldBeEqual(m => m.Description, o => o.Description); + else + assert.SkipProperty(m => m.Description); + + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.Url); + var dstProp = d.GetExpressionValue(ct => ct.Url); + + var srcUrl = s.Url; + var dstUrl = d.Url; + + srcUrl = UrlUtility.RemoveStartingSlash(srcUrl); + + var dstSubUrl = dstUrl.Replace(parentWeb.Url + "/", string.Empty); + var isValid = srcUrl.ToUpper() == dstSubUrl.ToUpper(); + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = dstProp, + IsValid = isValid + }; + }); + + // localization + if (definition.TitleResource.Any()) + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.TitleResource); + var isValid = true; + + foreach (var userResource in s.TitleResource) + { + var culture = LocalizationService.GetUserResourceCultureInfo(userResource); + var value = d.TitleResource.GetValueForUICulture(culture); + + isValid = userResource.Value == value; + + if (!isValid) + break; + } + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = null, + IsValid = isValid + }; + }); + } + else + { + assert.SkipProperty(m => m.TitleResource, "TitleResource is NULL or empty. Skipping."); + } + + if (definition.DescriptionResource.Any()) + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.DescriptionResource); + var isValid = true; + + foreach (var userResource in s.DescriptionResource) + { + var culture = LocalizationService.GetUserResourceCultureInfo(userResource); + var value = d.DescriptionResource.GetValueForUICulture(culture); + + isValid = userResource.Value == value; + + if (!isValid) + break; + } + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = null, + IsValid = isValid + }; + }); + } + else + { + assert.SkipProperty(m => m.DescriptionResource, "DescriptionResource is NULL or empty. Skipping."); + } + + if (definition.IndexedPropertyKeys.Any()) + { + assert.ShouldBeEqual((p, s, d) => + { + var srcProp = s.GetExpressionValue(def => def.IndexedPropertyKeys); + + // Search if any indexPropertyKey from definition is not in WebModel + var differentKeys = s.IndexedPropertyKeys.Select(o => o.Name) + .Except(d.IndexedPropertyKeys); + + var isValid = !differentKeys.Any(); + + return new PropertyValidationResult + { + Tag = p.Tag, + Src = srcProp, + Dst = null, + IsValid = isValid + }; + }); + } + else + assert.SkipProperty(m => m.IndexedPropertyKeys, "IndexedPropertyKeys is NULL or empty. Skipping."); + + + // O365 props + assert.SkipProperty(m => m.MembersCanShare, "Skipping O365 prop"); + assert.SkipProperty(m => m.RequestAccessEmail, "Skipping O365 prop"); + } + } +} diff --git a/SPMeta2/SPMeta2.Regression.Tests/Base/SPMeta2RegresionTestBase.cs b/SPMeta2/SPMeta2.Regression.Tests/Base/SPMeta2RegresionTestBase.cs index cef6e5f36..5bca64005 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Base/SPMeta2RegresionTestBase.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Base/SPMeta2RegresionTestBase.cs @@ -29,11 +29,87 @@ using SPMeta2.Regression.ModelHandlers; using SPMeta2.Regression.Tests.Impl.Scenarios.Webparts; using SPMeta2.Services; +using System.IO; +using SPMeta2.Regression.Utils; namespace SPMeta2.Regression.Tests.Base { public class SPMeta2RegresionTestCoreBase { + static SPMeta2RegresionTestCoreBase() + { + AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; + } + + static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) + { + var m2runner = Environment.GetEnvironmentVariable("SPMeta2_RunnerLibraries", EnvironmentVariableTarget.Machine); + var baseDir = AppDomain.CurrentDomain.BaseDirectory; + + RegressionUtils.WriteLine(string.Format("Resolving custom assembly binding for m2 runner:[{0}]", m2runner)); + + RegressionUtils.WriteLine(string.Format(" RequestingAssembly:[{0}]", args.RequestingAssembly)); + RegressionUtils.WriteLine(string.Format(" What requested:[{0}]", args.Name)); + + if (args.Name.Contains(".resources,")) + { + RegressionUtils.WriteLine("resources assembly. returning null"); + return null; + } + + var assemblyName = args.Name.Split(',')[0] + ".dll"; + var assemblyVersion = args.Name.Split(',')[1].Split('=')[1]; + + var assemblyDirs = new List(); + + if (assemblyName.Contains("Microsoft.SharePoint.Client.")) + { + switch (assemblyVersion) + { + case "16.1.0.0": + assemblyDirs.Add(Path.Combine(baseDir, @"_Dependencies\csom-v365")); + break; + + case "15.0.0.0": + assemblyDirs.Add(Path.Combine(baseDir, @"_Dependencies\csom-v2013")); + break; + } + } + + if (m2runner == "SPMeta2.Containers.O365v16.dll") + { + assemblyDirs.Add(Path.Combine(baseDir, @"_Dependencies\spmeta2-csom-365")); + assemblyDirs.Add(Path.Combine(baseDir, @"_Dependencies\spmeta2-csom-regression-365")); + } + + if (m2runner == "SPMeta2.Containers.O365.dll") + assemblyDirs.Add(Path.Combine(baseDir, @"_Dependencies\spmeta2-csom-2013")); + assemblyDirs.Add(Path.Combine(baseDir, @"_Dependencies\spmeta2-csom-regression-2013")); + + if (m2runner == "SPMeta2.Containers.CSOM.dll") + { + assemblyDirs.Add(Path.Combine(baseDir, @"_Dependencies\spmeta2-csom-2013")); + assemblyDirs.Add(Path.Combine(baseDir, @"_Dependencies\spmeta2-csom-regression-2013")); + } + + foreach (var dir in assemblyDirs) + { + var filePath = Path.Combine(dir, assemblyName); + + if (File.Exists(filePath)) + { + RegressionUtils.WriteLine(string.Format("Loading assemblly:[{0}]", filePath)); + return Assembly.LoadFile(filePath); + } + } + + throw new Exception(string.Format("Cannot load custom assembly:[{0}] for assembly:[{1}]", + args.Name, + args.RequestingAssembly + )); + } + + public SPMeta2RegresionTestCoreBase() { Rnd = new DefaultRandomService(); @@ -100,7 +176,7 @@ public SPMeta2ProvisionRegresionTestBase() TestOptions.EnableContentTypeHubTests = true; TestOptions.EnablWebConfigModificationTest = false; - + // too long, disabled by default // Module file provision fails at minor version 511 #930 // https://github.com/SubPointSolutions/spmeta2/issues/930 @@ -372,7 +448,7 @@ private void PleaseMakeSureWeCanSerializeDeserializeAndStillDeploy(IEnumerable + IndentableTrace.WithScope(trace => { trace.WriteLine("Saving-restoring XML/JSON models. Deployng.."); var serializedModels = RegressionService.GetSerializedAndRestoredModels(models); @@ -400,7 +476,7 @@ private void ProcessDefinitionsPropertyNulableValidation(DefinitionBase def) .Where(p => p.GetCustomAttributes(typeof(ExpectNullable), true).Count() > 0); - TraceUtils.WithScope(trace => + IndentableTrace.WithScope(trace => { trace.WriteLine(""); @@ -430,7 +506,7 @@ private void ProcessDefinitionsPropertyUpdateValidation(DefinitionBase def) .Where(p => p.GetCustomAttributes(typeof(ExpectUpdate), true).Count() > 0); - TraceUtils.WithScope(trace => + IndentableTrace.WithScope(trace => { trace.WriteLine(""); diff --git a/SPMeta2/SPMeta2.Regression.Tests/Containers/DesignPackages/ci-1-1.0.wsp b/SPMeta2/SPMeta2.Regression.Tests/Containers/DesignPackages/ci-1-1.0.wsp new file mode 100644 index 000000000..32b5e4c71 Binary files /dev/null and b/SPMeta2/SPMeta2.Regression.Tests/Containers/DesignPackages/ci-1-1.0.wsp differ diff --git a/SPMeta2/SPMeta2.Regression.Tests/Containers/DesignPackages/ci-1-1.1.wsp b/SPMeta2/SPMeta2.Regression.Tests/Containers/DesignPackages/ci-1-1.1.wsp new file mode 100644 index 000000000..4e6f1be09 Binary files /dev/null and b/SPMeta2/SPMeta2.Regression.Tests/Containers/DesignPackages/ci-1-1.1.wsp differ diff --git a/SPMeta2/SPMeta2.Regression.Tests/Containers/DesignPackages/ci-1-1.2.wsp b/SPMeta2/SPMeta2.Regression.Tests/Containers/DesignPackages/ci-1-1.2.wsp new file mode 100644 index 000000000..4e2167eab Binary files /dev/null and b/SPMeta2/SPMeta2.Regression.Tests/Containers/DesignPackages/ci-1-1.2.wsp differ diff --git a/SPMeta2/SPMeta2.Regression.Tests/Containers/DesignPackages/ci-1-1.4.wsp b/SPMeta2/SPMeta2.Regression.Tests/Containers/DesignPackages/ci-1-1.4.wsp new file mode 100644 index 000000000..936fc4938 Binary files /dev/null and b/SPMeta2/SPMeta2.Regression.Tests/Containers/DesignPackages/ci-1-1.4.wsp differ diff --git a/SPMeta2/SPMeta2.Regression.Tests/Containers/DesignPackages/ci-1-1.5.wsp b/SPMeta2/SPMeta2.Regression.Tests/Containers/DesignPackages/ci-1-1.5.wsp new file mode 100644 index 000000000..b89b9d44a Binary files /dev/null and b/SPMeta2/SPMeta2.Regression.Tests/Containers/DesignPackages/ci-1-1.5.wsp differ diff --git a/SPMeta2/SPMeta2.Regression.Tests/Extensions/ListDefinitionExtensions.cs b/SPMeta2/SPMeta2.Regression.Tests/Extensions/ListDefinitionExtensions.cs new file mode 100644 index 000000000..85a52f6c6 --- /dev/null +++ b/SPMeta2/SPMeta2.Regression.Tests/Extensions/ListDefinitionExtensions.cs @@ -0,0 +1,163 @@ +using SPMeta2.Definitions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + + +namespace SPMeta2.Regression.Tests.Extensions +{ + public static class ListDefinitionExtensions + { + public static string GetListUrl(this ListDefinition listDefinition) + { + + if (!string.IsNullOrEmpty(listDefinition.CustomUrl)) + return listDefinition.CustomUrl; + + if (listDefinition.Url.ToUpper().Contains("_CATALOGS")) + return listDefinition.Url; + + // BIG BIG BIG TODO + // correct list/doc lib mapping has to be implemented and tested + // very critical part of the whole provision lib + + var templateType = (ListTemplateType)listDefinition.TemplateType; + + switch (templateType) + { + case ListTemplateType.Events: + case ListTemplateType.Tasks: + case ListTemplateType.GenericList: + case ListTemplateType.AdminTasks: + case ListTemplateType.Agenda: + case ListTemplateType.Announcements: + case ListTemplateType.Comments: + case ListTemplateType.Contacts: + case ListTemplateType.DiscussionBoard: + case ListTemplateType.ExternalList: + case ListTemplateType.Links: + case ListTemplateType.WorkflowHistory: + case ListTemplateType.Facility: + case ListTemplateType.GanttTasks: + case ListTemplateType.Posts: + + return "Lists/" + listDefinition.Url; + + case ListTemplateType.CallTrack: + case ListTemplateType.Categories: + case ListTemplateType.Circulation: + case ListTemplateType.CustomGrid: + case ListTemplateType.DataConnectionLibrary: + case ListTemplateType.DataSources: + case ListTemplateType.Decision: + case ListTemplateType.DocumentLibrary: + + + case ListTemplateType.HealthReports: + case ListTemplateType.HealthRules: + case ListTemplateType.Holidays: + case ListTemplateType.HomePageLibrary: + case ListTemplateType.IMEDic: + case ListTemplateType.InvalidType: + case ListTemplateType.IssueTracking: + + case ListTemplateType.ListTemplateCatalog: + case ListTemplateType.MasterPageCatalog: + case ListTemplateType.MeetingObjective: + case ListTemplateType.MeetingUser: + case ListTemplateType.Meetings: + case ListTemplateType.NoCodePublic: + case ListTemplateType.NoCodeWorkflows: + case ListTemplateType.NoListTemplate: + case ListTemplateType.PictureLibrary: + + case ListTemplateType.SolutionCatalog: + case ListTemplateType.Survey: + case ListTemplateType.TextBox: + case ListTemplateType.ThemeCatalog: + case ListTemplateType.ThingsToBring: + case ListTemplateType.Timecard: + case ListTemplateType.UserInformation: + case ListTemplateType.WebPageLibrary: + case ListTemplateType.WebPartCatalog: + case ListTemplateType.WebTemplateCatalog: + case ListTemplateType.Whereabouts: + + case ListTemplateType.WorkflowProcess: + case ListTemplateType.XMLForm: + + break; + default: + break; + } + + return listDefinition.Url; + } + + + private enum ListTemplateType + { + InvalidType = -1, + NoListTemplate = 0, + GenericList = 100, + DocumentLibrary = 101, + Survey = 102, + Links = 103, + Announcements = 104, + Contacts = 105, + Events = 106, + Tasks = 107, + DiscussionBoard = 108, + PictureLibrary = 109, + DataSources = 110, + WebTemplateCatalog = 111, + UserInformation = 112, + WebPartCatalog = 113, + ListTemplateCatalog = 114, + XMLForm = 115, + MasterPageCatalog = 116, + NoCodeWorkflows = 117, + WorkflowProcess = 118, + WebPageLibrary = 119, + CustomGrid = 120, + SolutionCatalog = 121, + NoCodePublic = 122, + ThemeCatalog = 123, + DesignCatalog = 124, + AppDataCatalog = 125, + DataConnectionLibrary = 130, + WorkflowHistory = 140, + GanttTasks = 150, + HelpLibrary = 151, + AccessRequest = 160, + TasksWithTimelineAndHierarchy = 171, + MaintenanceLogs = 175, + Meetings = 200, + Agenda = 201, + MeetingUser = 202, + Decision = 204, + MeetingObjective = 207, + TextBox = 210, + ThingsToBring = 211, + HomePageLibrary = 212, + Posts = 301, + Comments = 302, + Categories = 303, + Facility = 402, + Whereabouts = 403, + CallTrack = 404, + Circulation = 405, + Timecard = 420, + Holidays = 421, + IMEDic = 499, + ExternalList = 600, + MySiteDocumentLibrary = 700, + IssueTracking = 1100, + AdminTasks = 1200, + HealthRules = 1220, + HealthReports = 1221, + DeveloperSiteDraftApps = 1230, + } + } +} diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Definitions/DefinitionTests.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Definitions/DefinitionTests.cs index e7640b56b..c02d96fbc 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Definitions/DefinitionTests.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Definitions/DefinitionTests.cs @@ -21,7 +21,8 @@ using SPMeta2.Regression.Tests.Config; using SPMeta2.Services; using SPMeta2.Containers.Utils; -using SPMeta2.Standard.Definitions.Webparts; +using SPMeta2.Standard.Definitions.Webparts; +using SPMeta2.Regression.Utils; namespace SPMeta2.Regression.Tests.Impl.Definitions { @@ -128,7 +129,7 @@ public void DefinitionsShouldHaveToStringOverride() var hasToStringOverride = definitionType.GetMethod("ToString").DeclaringType == definitionType; if (!hasToStringOverride) - Trace.WriteLine(string.Format("Checking definition type:[{0}]. Has override:[{1}]", definitionType, hasToStringOverride)); + RegressionUtils.WriteLine(string.Format("Checking definition type:[{0}]. Has override:[{1}]", definitionType, hasToStringOverride)); Assert.IsTrue(hasToStringOverride); } @@ -145,7 +146,7 @@ public void DefinitionsShouldBeMarkedAsSerializable() { var hasAttr = definitionType.GetCustomAttributes(typeof(SerializableAttribute)).Any(); - Trace.WriteLine(string.Format("[{2}] - Checking definition type:[{0}]. Has SerializableAttribute:[{1}]", + RegressionUtils.WriteLine(string.Format("[{2}] - Checking definition type:[{0}]. Has SerializableAttribute:[{1}]", definitionType, hasAttr, hasAttr.ToString().ToUpper())); if (!hasAttr) @@ -168,7 +169,7 @@ public void DefinitionsShouldBeMarkedAsDataContract() if (!hasAttr) { - Trace.WriteLine(string.Format("[{2}] - Checking definition type:[{0}]. Has DataContractAttribute:[{1}]", + RegressionUtils.WriteLine(string.Format("[{2}] - Checking definition type:[{0}]. Has DataContractAttribute:[{1}]", definitionType, hasAttr, hasAttr.ToString().ToUpper())); } @@ -193,7 +194,7 @@ public void ModelNodesShouldBeMarkedAsDataContract_v12() if (!hasAttr) { - Trace.WriteLine(string.Format("[{2}] - Checking model node type:[{0}]. Has DataContractAttribute:[{1}]", + RegressionUtils.WriteLine(string.Format("[{2}] - Checking model node type:[{0}]. Has DataContractAttribute:[{1}]", modelNodeType, hasAttr, hasAttr.ToString().ToUpper())); } @@ -219,7 +220,7 @@ public void DefinitionsShouldHasIdentityOrIdentityKey() if (isSingleIdenity) { - //Trace.WriteLine(string.Format("[{1}] - Checking SINGLE type:[{0}].", definitionType, bool.TrueString.ToUpper())); + //RegressionUtils.WriteLine(string.Format("[{1}] - Checking SINGLE type:[{0}].", definitionType, bool.TrueString.ToUpper())); continue; } @@ -232,7 +233,7 @@ public void DefinitionsShouldHasIdentityOrIdentityKey() .Any(); if (!hasKeys) { - Trace.WriteLine(string.Format("[{2}] - Checking INSTANCE type:[{0}]. Has keys:[{1}]", + RegressionUtils.WriteLine(string.Format("[{2}] - Checking INSTANCE type:[{0}]. Has keys:[{1}]", definitionType, hasKeys, hasKeys.ToString().ToUpper())); } @@ -267,7 +268,7 @@ public void ModelNodeTypesPublicPropsShouldBeMarkedAsDataMemberOrIgnoreDataMembe if (!hasAttr) { - Trace.WriteLine(string.Format("[{2}] - Checking definition type:[{0}]. Prop:[{1}]", + RegressionUtils.WriteLine(string.Format("[{2}] - Checking definition type:[{0}]. Prop:[{1}]", definitionType.Name, prop.Name, hasAttr)); } @@ -279,7 +280,7 @@ public void ModelNodeTypesPublicPropsShouldBeMarkedAsDataMemberOrIgnoreDataMembe } } - Trace.WriteLine(string.Format("Errors: [{0}]", errors)); + RegressionUtils.WriteLine(string.Format("Errors: [{0}]", errors)); Assert.IsTrue(result); } @@ -292,7 +293,7 @@ public void DefinitionsPublicPropsShouldBeMarkedAsDataMemberOrIgnoreDataMemberAt var targetTypes = AllDefinitionTypes; var errors = CheckDataMemberOrIgnoreDataMemberAttr(targetTypes); - Trace.WriteLine(string.Format("Errors: [{0}]", errors)); + RegressionUtils.WriteLine(string.Format("Errors: [{0}]", errors)); Assert.IsTrue(errors == 0); } @@ -312,7 +313,7 @@ public void TypedWebPartDefinitions_Should_Have_ExpectWebpartType_Attr() if (!hasAttr) { - Trace.WriteLine(string.Format(" - Checking type:[{0}]. Has:[{1}] Attr:[ExpectWebpartType]", + RegressionUtils.WriteLine(string.Format(" - Checking type:[{0}]. Has:[{1}] Attr:[ExpectWebpartType]", definitionType.Name, hasAttr)); } @@ -322,7 +323,7 @@ public void TypedWebPartDefinitions_Should_Have_ExpectWebpartType_Attr() } } - Trace.WriteLine(string.Format("Errors: [{0}]", errors)); + RegressionUtils.WriteLine(string.Format("Errors: [{0}]", errors)); Assert.IsTrue(errors == 0); } @@ -342,7 +343,7 @@ private static int CheckDataMemberOrIgnoreDataMemberAttr(List types) if (!hasAttr) { - Trace.WriteLine(string.Format("[{2}] - Checking type:[{0}]. Prop:[{1}]", + RegressionUtils.WriteLine(string.Format("[{2}] - Checking type:[{0}]. Prop:[{1}]", definitionType.Name, prop.Name, hasAttr)); } @@ -373,7 +374,7 @@ public void AllSerializablesPublicPropsShouldBeMarkedAsDataMemberOrIgnoreDataMem var errors = CheckDataMemberOrIgnoreDataMemberAttr(targetTypes); - Trace.WriteLine(string.Format("Errors: [{0}]", errors)); + RegressionUtils.WriteLine(string.Format("Errors: [{0}]", errors)); Assert.IsTrue(errors == 0); } @@ -403,12 +404,12 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v11() { var definitionName = definitionType.Name.Replace("Definition", string.Empty); - Trace.WriteLine(string.Format("Definition: [{0}]", definitionName)); + RegressionUtils.WriteLine(string.Format("Definition: [{0}]", definitionName)); #region AddXXX() // validate (this ModelNode model, XXXDefinition definition) - Trace.WriteLine(string.Format(" Add{0}(this ModelNode model, {0}Definition definition)", definitionName)); + RegressionUtils.WriteLine(string.Format(" Add{0}(this ModelNode model, {0}Definition definition)", definitionName)); var addDefinitionMethodName = string.Format("Add{0}", definitionName); var hasAddDefinitionMethod = methods.FirstOrDefault(m => @@ -417,7 +418,7 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v11() m.GetParameters()[0].ParameterType == typeof(ModelNode) && m.GetParameters()[1].ParameterType == definitionType) != null; - Trace.WriteLine(string.Format(" Add{0}(this ModelNode model, {0}Definition definition, Action action))", definitionName)); + RegressionUtils.WriteLine(string.Format(" Add{0}(this ModelNode model, {0}Definition definition, Action action))", definitionName)); // 2. should be one with "(this ModelNode model, XXXDefinition definition, Action action)" var hasAddDefinitionWithCallbackMethod = true; @@ -429,8 +430,8 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v11() // m.GetParameters()[2].ParameterType == typeof(Action)) != null; - Trace.WriteLine(string.Format(" [{0}] - Add{1}(this ModelNode model, {1}Definition definition))", hasAddDefinitionMethod.ToString().ToUpper(), definitionName)); - Trace.WriteLine(string.Format(" [{0}] - Add{1}(this ModelNode model, {1}Definition definition, Action action))", hasAddDefinitionWithCallbackMethod.ToString().ToUpper(), definitionName)); + RegressionUtils.WriteLine(string.Format(" [{0}] - Add{1}(this ModelNode model, {1}Definition definition))", hasAddDefinitionMethod.ToString().ToUpper(), definitionName)); + RegressionUtils.WriteLine(string.Format(" [{0}] - Add{1}(this ModelNode model, {1}Definition definition, Action action))", hasAddDefinitionWithCallbackMethod.ToString().ToUpper(), definitionName)); #endregion @@ -442,7 +443,7 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v11() if (shouldCheckArrayOverload) { // validate (this ModelNode model, XXXDefinition definition) - Trace.WriteLine( + RegressionUtils.WriteLine( string.Format( " Add{0}s(this ModelNode model, IEnumerable<{0}Definition> definitions, Action action))", definitionName)); @@ -470,14 +471,14 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v11() m.GetParameters()[0].ParameterType == typeof(ModelNode) && m.GetParameters()[1].ParameterType == arrayDefinitionType) != null; - Trace.WriteLine( + RegressionUtils.WriteLine( string.Format(" [{0}] - {1}(this ModelNode model, IEnumerable<{2}Definition> definitions))", hasAddArrayDefinitionMethod.ToString().ToUpper(), addArrayDefinitionMethodName, definitionName)); } else { - Trace.WriteLine(string.Format(" [SKIPPING] Skipping AddXXXs() arrary overload as there is no ExpectArrayExtensionMethod attr")); + RegressionUtils.WriteLine(string.Format(" [SKIPPING] Skipping AddXXXs() arrary overload as there is no ExpectArrayExtensionMethod attr")); } #endregion @@ -493,7 +494,7 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v11() if (shouldCheckAddHostOverload) { // validate (this ModelNode model, XXXDefinition definition) - Trace.WriteLine(string.Format(" AddHost{0}(this ModelNode model, {0}Definition definition)", + RegressionUtils.WriteLine(string.Format(" AddHost{0}(this ModelNode model, {0}Definition definition)", definitionName)); var addHostDefinitionMethodName = string.Format("AddHost{0}", definitionName); @@ -503,7 +504,7 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v11() m.GetParameters()[0].ParameterType == typeof(ModelNode) && m.GetParameters()[1].ParameterType == definitionType) != null; - Trace.WriteLine( + RegressionUtils.WriteLine( string.Format( " AddHost{0}(this ModelNode model, {0}Definition definition, Action action))", definitionName)); @@ -516,17 +517,17 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v11() m.GetParameters()[2].ParameterType == typeof(Action)) != null; - Trace.WriteLine( + RegressionUtils.WriteLine( string.Format(" [{0}] - AddHost{1}(this ModelNode model, {1}Definition definition))", hasAddHostDefinitionMethod.ToString().ToUpper(), definitionName)); - Trace.WriteLine( + RegressionUtils.WriteLine( string.Format( " [{0}] - AddHost{1}(this ModelNode model, {1}Definition definition, Action action))", hasAddHostDefinitionWithCallbackMethod.ToString().ToUpper(), definitionName)); } else { - Trace.WriteLine(string.Format(" [SKIPPING] Skipping AddHostXXX() methods as there is no ExpectAddHostExtensionMethod attr")); + RegressionUtils.WriteLine(string.Format(" [SKIPPING] Skipping AddHostXXX() methods as there is no ExpectAddHostExtensionMethod attr")); } #endregion @@ -564,7 +565,7 @@ public void DefinitionsShouldHaveWithXXX_DefinitionSyntax_v11() { var definitionName = definitionType.Name.Replace("Definition", string.Empty); - Trace.WriteLine(string.Format("Definition: [{0}]", definitionName)); + RegressionUtils.WriteLine(string.Format("Definition: [{0}]", definitionName)); var shouldCheckWithMethod = definitionType.GetCustomAttributes(typeof(ExpectWithExtensionMethod), false).Any(); @@ -586,7 +587,7 @@ public void DefinitionsShouldHaveWithXXX_DefinitionSyntax_v11() if (!shouldCheckWithMethod) { if (showSkipping) - Trace.WriteLine(string.Format(" {0}(this ModelNode model, {0}Definition definition, Action action)) - SKIPPING", addDefinitionMethodName)); + RegressionUtils.WriteLine(string.Format(" {0}(this ModelNode model, {0}Definition definition, Action action)) - SKIPPING", addDefinitionMethodName)); continue; } @@ -599,9 +600,9 @@ public void DefinitionsShouldHaveWithXXX_DefinitionSyntax_v11() m.GetParameters()[1].ParameterType == typeof(Action)) != null; if (hasWithMethod) - Trace.WriteLine(string.Format(" {0}(this ModelNode model, {0}Definition definition, Action action)) - TRUE", addDefinitionMethodName)); + RegressionUtils.WriteLine(string.Format(" {0}(this ModelNode model, {0}Definition definition, Action action)) - TRUE", addDefinitionMethodName)); else - Trace.WriteLine(string.Format(" {0}(this ModelNode model, {0}Definition definition, Action action)) - FALSE", addDefinitionMethodName)); + RegressionUtils.WriteLine(string.Format(" {0}(this ModelNode model, {0}Definition definition, Action action)) - FALSE", addDefinitionMethodName)); #endregion @@ -661,21 +662,21 @@ public void DefinitionsShouldHave_ParentHostCapabilityAttribute_v12() var defTypesWithoutRelationships = AllDefinitionTypes.Where(d => AllDefinitionRelationships.All(r => r.DefinitionType != d)); - Trace.WriteLine("Cheking ParentHostCapability attr presence for all definitions"); + RegressionUtils.WriteLine("Cheking ParentHostCapability attr presence for all definitions"); - TraceUtils.WithScope(trace => + IndentableTrace.WithScope(trace => { foreach (var def in defTypesWithoutRelationships) - Trace.WriteLine(string.Format("missing relationship for definition:[{0}]", def.Name)); + RegressionUtils.WriteLine(string.Format("missing relationship for definition:[{0}]", def.Name)); }); if (defTypesWithoutRelationships.Any()) passed = false; if (defTypesWithoutRelationships.Any()) - Trace.WriteLine("[FALSE] Missing definition relationships detected"); + RegressionUtils.WriteLine("[FALSE] Missing definition relationships detected"); else - Trace.WriteLine("[TRUE] Missing definition relationships detected"); + RegressionUtils.WriteLine("[TRUE] Missing definition relationships detected"); Assert.IsTrue(passed); } @@ -686,13 +687,13 @@ public void DefinitionsShouldHave_ParentHostCapabilityAttribute_v12() [TestCategory("CI.Core")] public void DefinitionsShouldHave_TypedModelNodes_v12() { - Trace.WriteLine("Checking typed model nodes"); - Trace.WriteLine(""); + RegressionUtils.WriteLine("Checking typed model nodes"); + RegressionUtils.WriteLine(""); var passes = true; var showOnlyFalseOutput = true; - TraceUtils.WithScope(trace => + IndentableTrace.WithScope(trace => { foreach (var defType in AllDefinitionTypes.OrderBy(d => d.Name)) { @@ -748,10 +749,10 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v12() // AddField(this TModelNode model, FieldDefinition definition, Action action) // where TModelNode : ModelNode, IFieldHostModelNode, new() - Trace.WriteLine("Checking AddXXX() method specs"); - Trace.WriteLine(""); + RegressionUtils.WriteLine("Checking AddXXX() method specs"); + RegressionUtils.WriteLine(""); - TraceUtils.WithScope(trace => + IndentableTrace.WithScope(trace => { foreach (var defType in AllDefinitionTypes.OrderBy(d => d.Name)) { @@ -973,7 +974,7 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v12() passed = false; completedtype = false; - addXXXTrace.WriteLine("[FALSE] AddXXX()"); + RegressionUtils.WriteLine("[FALSE] AddXXX()"); } else { @@ -982,9 +983,9 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v12() if (missedRelationshipModelNodeTypes.Any()) { passed = false; - completedtype = false; - - addXXXTrace.WriteLine(string.Format( + completedtype = false; + + RegressionUtils.WriteLine(string.Format( "[FALSE] AddXXX() misses relationships: [{0}]", string.Join(",", missedRelationshipModelNodeTypes))); } @@ -993,9 +994,9 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v12() if (addMethodPlainWithCallBack == null) { passed = false; - completedtype = false; - - addXXXTrace.WriteLine("[FALSE] AddXXX(callback)"); + completedtype = false; + + RegressionUtils.WriteLine("[FALSE] AddXXX(callback)"); } else { @@ -1004,9 +1005,9 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v12() if (missedRelationshipModelNodeTypes.Any()) { passed = false; - completedtype = false; - - addXXXTrace.WriteLine(string.Format( + completedtype = false; + + RegressionUtils.WriteLine(string.Format( "[FALSE] AddXXX(callback) misses relationships: [{0}]", string.Join(",", missedRelationshipModelNodeTypes))); } @@ -1019,9 +1020,9 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v12() if (addMethodWithArraySupport == null) { passed = false; - completedtype = false; - - addXXXTrace.WriteLine("[FALSE] AddXXXs()"); + completedtype = false; + + RegressionUtils.WriteLine("[FALSE] AddXXXs()"); } else { @@ -1030,9 +1031,9 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v12() if (missedRelationshipModelNodeTypes.Any()) { passed = false; - completedtype = false; - - addXXXTrace.WriteLine(string.Format( + completedtype = false; + + RegressionUtils.WriteLine(string.Format( "[FALSE] AddXXXs() misses relationships: [{0}]", string.Join(",", missedRelationshipModelNodeTypes))); } @@ -1048,9 +1049,9 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v12() if (addHostMethodPlain == null) { passed = false; - completedtype = false; - - addXXXTrace.WriteLine("[FALSE] AddHostXXX()"); + completedtype = false; + + RegressionUtils.WriteLine("[FALSE] AddHostXXX()"); } else { @@ -1059,9 +1060,9 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v12() if (missedRelationshipModelNodeTypes.Any()) { passed = false; - completedtype = false; - - addXXXTrace.WriteLine(string.Format( + completedtype = false; + + RegressionUtils.WriteLine(string.Format( "[FALSE] AddHostXXX() misses relationships: [{0}]", string.Join(",", missedRelationshipModelNodeTypes))); } @@ -1070,9 +1071,9 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v12() if (addHostMethodPlainWithCallBack == null) { passed = false; - completedtype = false; - - addXXXTrace.WriteLine("[FALSE] AddHostXXX(callback)"); + completedtype = false; + + RegressionUtils.WriteLine("[FALSE] AddHostXXX(callback)"); } else { @@ -1081,9 +1082,9 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v12() if (missedRelationshipModelNodeTypes.Any()) { passed = false; - completedtype = false; - - addXXXTrace.WriteLine(string.Format( + completedtype = false; + + RegressionUtils.WriteLine(string.Format( "[FALSE] AddHostXXX(callback) misses relationships: [{0}]", string.Join(",", missedRelationshipModelNodeTypes))); } @@ -1099,8 +1100,8 @@ public void DefinitionsShouldHaveAddXXX_DefinitionSyntax_v12() } }); - Trace.WriteLine(""); - Trace.WriteLine(string.Format("{0}/{1}", missesCount, allCount)); + RegressionUtils.WriteLine(""); + RegressionUtils.WriteLine(string.Format("{0}/{1}", missesCount, allCount)); Assert.IsTrue(passed); } diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Definitions/FieldDefinitionTests.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Definitions/FieldDefinitionTests.cs index 5f3cadcb5..fa36ab02e 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Definitions/FieldDefinitionTests.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Definitions/FieldDefinitionTests.cs @@ -20,7 +20,8 @@ using SPMeta2.Standard.Definitions.Taxonomy; using SPMeta2.Syntax.Default; using SPMeta2.Utils; -using SPMeta2.Regression.Tests.Base; +using SPMeta2.Regression.Tests.Base; +using SPMeta2.Regression.Utils; namespace SPMeta2.Regression.Tests.Impl.Definitions { @@ -56,7 +57,7 @@ public void FieldDefinitions_ShouldHave_Correct_Indexed_Property() foreach (var fieldDefintion in fieldDefinitionTypes) { - Trace.WriteLine(string.Format("Checking Indexed prop for Indexed def:[{0}]", fieldDefintion.GetType().Name)); + RegressionUtils.WriteLine(string.Format("Checking Indexed prop for Indexed def:[{0}]", fieldDefintion.GetType().Name)); var indexedSiteModel = SPMeta2Model.NewSiteModel(m => { }); var indexedSiteField = ModelGeneratorService.GetRandomDefinition(fieldDefintion) as FieldDefinition; @@ -75,7 +76,7 @@ public void FieldDefinitions_ShouldHave_Correct_Indexed_Property() TestModel(indexedSiteModel); - Trace.WriteLine(string.Format("Checking Indexed prop for non-Indexed def:[{0}]", fieldDefintion.GetType().Name)); + RegressionUtils.WriteLine(string.Format("Checking Indexed prop for non-Indexed def:[{0}]", fieldDefintion.GetType().Name)); var nonIdexedSiteModel = SPMeta2Model.NewSiteModel(m => { }); var nonIndexedSiteField = ModelGeneratorService.GetRandomDefinition(fieldDefintion) as FieldDefinition; @@ -107,7 +108,7 @@ public void FieldDefinitions_ShouldHave_Correct_ValidationMessageAndFormula_Prop foreach (var fieldDefintion in fieldDefinitionTypes) { - Trace.WriteLine(string.Format("Checking Indexed propr for Indexed def:[{0}]", fieldDefintion.GetType().Name)); + RegressionUtils.WriteLine(string.Format("Checking Indexed propr for Indexed def:[{0}]", fieldDefintion.GetType().Name)); var siteModel = SPMeta2Model.NewSiteModel(m => { }); var siteField = ModelGeneratorService.GetRandomDefinition(fieldDefintion) as FieldDefinition; diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/ModelAPI/SPMeta2ModelTests.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/ModelAPI/SPMeta2ModelTests.cs index dc16acfc9..d644950a0 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/ModelAPI/SPMeta2ModelTests.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/ModelAPI/SPMeta2ModelTests.cs @@ -121,7 +121,7 @@ public void CanSerialize_SiteModelToXMLAndBack() }); - TraceUtils.WithScope(trace => + IndentableTrace.WithScope(trace => { var modelString = SPMeta2Model.ToXML(orginalModel); Assert.IsFalse(string.IsNullOrEmpty(modelString)); @@ -146,7 +146,7 @@ public void CanSerialize_SiteModelToJSONAndBack() }); - TraceUtils.WithScope(trace => + IndentableTrace.WithScope(trace => { var modelString = SPMeta2Model.ToJSON(orginalModel); Assert.IsFalse(string.IsNullOrEmpty(modelString)); @@ -209,5 +209,115 @@ public void Should_Pass_On_Valid_SSOM_Invalid_CSOM_2() } #endregion + + #region new model API + + [TestMethod] + [TestCategory("Regression.SPMeta2Model.NewXXXModel")] + [TestCategory("CI.Core")] + public void SPMeta2Model_NewFarmModel_Contract() + { + var expectedType = typeof(FarmModelNode); + var newDefinition = new FarmDefinition(); + + // new + Assert.IsTrue(SPMeta2Model.NewFarmModel().GetType() == expectedType); + + // new with callback + Assert.IsTrue(SPMeta2Model.NewFarmModel(model => { }).GetType() == expectedType); + + // new definition + Assert.IsTrue(SPMeta2Model.NewFarmModel(newDefinition).GetType() == expectedType); + + // new definition with callback + Assert.IsTrue(SPMeta2Model.NewFarmModel(newDefinition, farm => { }).GetType() == expectedType); + } + + [TestMethod] + [TestCategory("Regression.SPMeta2Model.NewXXXModel")] + [TestCategory("CI.Core")] + public void SPMeta2Model_NewWebAppModel_Contract() + { + var expectedType = typeof(WebApplicationModelNode); + var newDefinition = new WebApplicationDefinition(); + + // new + Assert.IsTrue(SPMeta2Model.NewWebApplicationModel().GetType() == expectedType); + + // new with callback + Assert.IsTrue(SPMeta2Model.NewWebApplicationModel(model => { }).GetType() == expectedType); + + // new definition + Assert.IsTrue(SPMeta2Model.NewWebApplicationModel(newDefinition).GetType() == expectedType); + + // new definition with callback + Assert.IsTrue(SPMeta2Model.NewWebApplicationModel(newDefinition, farm => { }).GetType() == expectedType); + } + + [TestMethod] + [TestCategory("Regression.SPMeta2Model.NewXXXModel")] + [TestCategory("CI.Core")] + public void SPMeta2Model_NewSiteModel_Contract() + { + var expectedType = typeof(SiteModelNode); + var newDefinition = new SiteDefinition(); + + // new + Assert.IsTrue(SPMeta2Model.NewSiteModel().GetType() == expectedType); + + // new with callback + Assert.IsTrue(SPMeta2Model.NewSiteModel(model => { }).GetType() == expectedType); + + // new definition + Assert.IsTrue(SPMeta2Model.NewSiteModel(newDefinition).GetType() == expectedType); + + // new definition with callback + Assert.IsTrue(SPMeta2Model.NewSiteModel(newDefinition, node => { }).GetType() == expectedType); + } + + + [TestMethod] + [TestCategory("Regression.SPMeta2Model.NewXXXModel")] + [TestCategory("CI.Core")] + public void SPMeta2Model_NewWebModel_Contract() + { + var expectedType = typeof(WebModelNode); + var newDefinition = new WebDefinition(); + + // new + Assert.IsTrue(SPMeta2Model.NewWebModel().GetType() == expectedType); + + // new with callback + Assert.IsTrue(SPMeta2Model.NewWebModel(model => { }).GetType() == expectedType); + + // new definition + Assert.IsTrue(SPMeta2Model.NewWebModel(newDefinition).GetType() == expectedType); + + // new definition with callback + Assert.IsTrue(SPMeta2Model.NewWebModel(newDefinition, node => { }).GetType() == expectedType); + } + + [TestMethod] + [TestCategory("Regression.SPMeta2Model.NewXXXModel")] + [TestCategory("CI.Core")] + public void SPMeta2Model_NewListModel_Contract() + { + var expectedType = typeof(ListModelNode); + var newDefinition = new ListDefinition(); + + // new + Assert.IsTrue(SPMeta2Model.NewListModel().GetType() == expectedType); + + // new with callback + Assert.IsTrue(SPMeta2Model.NewListModel(model => { }).GetType() == expectedType); + + // new definition + Assert.IsTrue(SPMeta2Model.NewListModel(newDefinition).GetType() == expectedType); + + // new definition with callback + Assert.IsTrue(SPMeta2Model.NewListModel(newDefinition, node => { }).GetType() == expectedType); + } + + #endregion } } diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Random/RandomDefinitionTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Random/RandomDefinitionTest.cs index a02867410..2ad097068 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Random/RandomDefinitionTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Random/RandomDefinitionTest.cs @@ -30,6 +30,7 @@ using SPMeta2.Standard.Definitions.DisplayTemplates; using SPMeta2.Validation.Services; using SPMeta2.Exceptions; +using SPMeta2.Regression.Utils; namespace SPMeta2.Regression.Tests.Impl.Random { @@ -54,7 +55,7 @@ public void RandomDefinitionTest_ShouldHave_Tests_ForAllDefinitions() foreach (var def in allDefinitions) { - Trace.WriteLine(def.Name); + RegressionUtils.WriteLine(def.Name); } var isValid = true; @@ -65,7 +66,7 @@ public void RandomDefinitionTest_ShouldHave_Tests_ForAllDefinitions() if (!hasTestMethod) { - Trace.WriteLine(string.Format("[ERR]:{0}", definition.Name)); + RegressionUtils.WriteLine(string.Format("[ERR]:{0}", definition.Name)); isValid = false; } @@ -78,7 +79,7 @@ private bool HasTestMethod(string methodPrefix, Type definition, MethodInfo[] me { var methodName = string.Format("{0}{1}", methodPrefix, definition.Name); - Trace.WriteLine(string.Format("Asserting method:[{0}]", methodName)); + RegressionUtils.WriteLine(string.Format("Asserting method:[{0}]", methodName)); var targetMethod = methods.FirstOrDefault(m => m.Name == methodName); @@ -97,7 +98,7 @@ public RandomDefinitionTest() EnablePropertyNullableValidation = true; PropertyNullableGenerationCount = 1; - RegressionService.ShowOnlyFalseResults = true; + RegressionService.ShowOnlyFalseResults = false; } #region common diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/RegressionAPI/RegressionAPITests.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/RegressionAPI/RegressionAPITests.cs index f6f18f4e8..601c06a74 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/RegressionAPI/RegressionAPITests.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/RegressionAPI/RegressionAPITests.cs @@ -44,7 +44,7 @@ public void ExpectUpdateAttributes_ShouldHave_Services() updateAttrServices.AddRange(ReflectionUtils.GetTypesFromAssembly(typeof(ExpectUpdateValueServiceBase).Assembly) .Select(t => Activator.CreateInstance(t) as ExpectUpdateValueServiceBase)); - TraceUtils.WithScope(trace => + IndentableTrace.WithScope(trace => { foreach (var attr in updateAttrTypes) { diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Reports/DefinitionReportTests.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Reports/DefinitionReportTests.cs index 98348dfa4..c66370f04 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Reports/DefinitionReportTests.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Reports/DefinitionReportTests.cs @@ -6,7 +6,8 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; +using System.Text; +using SPMeta2.Regression.Utils; namespace SPMeta2.Regression.Tests.Impl.Reports @@ -41,7 +42,7 @@ public void CreateDefinitionCoverageReport() var validatedProps = allProps.Where(p => p.GetCustomAttributes(typeof(ExpectValidationAttribute)).Any()); var updatableProps = allProps.Where(p => p.GetCustomAttributes(true).Any(a => (a as ExpectUpdate) != null)); - Trace.WriteLine(definitionType.Name); + RegressionUtils.WriteLine(definitionType.Name); result.Append(""); @@ -73,7 +74,7 @@ public void CreateDefinitionCoverageReport() result.AppendFormat("", isValidated); result.AppendFormat("", isUpdated); - Trace.WriteLine(string.Format("{0}{1} - validated:{2} updated:{3}", '\t', prop.Name, isValidated, isUpdated)); + RegressionUtils.WriteLine(string.Format("{0}{1} - validated:{2} updated:{3}", '\t', prop.Name, isValidated, isUpdated)); isFirst = false; @@ -89,7 +90,7 @@ public void CreateDefinitionCoverageReport() } var reportHtml = result.ToString(); - Trace.WriteLine(reportHtml); + RegressionUtils.WriteLine(reportHtml); } #endregion diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/AppScenariousTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/AppScenariousTest.cs index affb3895d..c045acdcd 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/AppScenariousTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/AppScenariousTest.cs @@ -19,7 +19,8 @@ using SPMeta2.Containers.Consts; using System.Diagnostics; using SPMeta2.Exceptions; -using SPMeta2.Regression.Tests.Utils; +using SPMeta2.Regression.Tests.Utils; +using SPMeta2.Regression.Utils; namespace SPMeta2.Regression.Tests.Impl.Scenarios @@ -215,8 +216,8 @@ private void AddAndCheckRandomAppWithVersion(WebModelNode web, Version version) { app.OnProvisioned(context => { - Trace.WriteLine(context.ObjectDefinition.ToString()); - Trace.WriteLine(context.Object.ToString()); + RegressionUtils.WriteLine(context.ObjectDefinition.ToString()); + RegressionUtils.WriteLine(context.Object.ToString()); var expectedAppVersion = new Version(context.ObjectDefinition.Version); diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/FieldScenariosTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/FieldScenariosTest.cs index 1275dac27..fb1acc5f9 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/FieldScenariosTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/FieldScenariosTest.cs @@ -25,6 +25,7 @@ using SPMeta2.Regression.Tests.Utils; using ReflectionUtils = SPMeta2.Utils.ReflectionUtils; +using SPMeta2.Regression.Utils; namespace SPMeta2.Regression.Tests.Impl.Scenarios { @@ -55,7 +56,7 @@ public void SelfDiagnostic_AllFields_Should_Have_DefaultValue_Tests() targetTypes.AddRange(ReflectionUtils.GetTypesFromAssemblies(assemblies)); - Trace.WriteLine(string.Format("Found [{0}] fied types.", targetTypes.Count)); + RegressionUtils.WriteLine(string.Format("Found [{0}] fied types.", targetTypes.Count)); foreach (var fieldType in targetTypes.OrderBy(m => m.Name)) { @@ -69,7 +70,7 @@ public void SelfDiagnostic_AllFields_Should_Have_DefaultValue_Tests() if (!testExists) isValid = false; - Trace.WriteLine(string.Format("[{0}] def: {1} test method: {2}", + RegressionUtils.WriteLine(string.Format("[{0}] def: {1} test method: {2}", testExists, fullDefName, testName)); } @@ -461,10 +462,10 @@ protected List GetAllRandomFields() var spMetaAssembly = typeof(FieldDefinition).Assembly; var spMetaStandardAssembly = typeof(TaxonomyFieldDefinition).Assembly; - var types = SPMeta2.Utils.ReflectionUtils.GetTypesFromAssemblies(new[] - { - spMetaAssembly, - spMetaStandardAssembly + var types = SPMeta2.Utils.ReflectionUtils.GetTypesFromAssemblies(new[] + { + spMetaAssembly, + spMetaStandardAssembly }); var result = new List(); diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/CalculatedFieldScenariousTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/CalculatedFieldScenariousTest.cs index 587064bda..ad83b8c6f 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/CalculatedFieldScenariousTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/CalculatedFieldScenariousTest.cs @@ -4,7 +4,7 @@ using System.ComponentModel; using Microsoft.VisualStudio.TestTools.UnitTesting; using SPMeta2.Containers; -using SPMeta2.CSOM.DefaultSyntax; + using SPMeta2.Definitions; using SPMeta2.Definitions.Fields; using SPMeta2.Enumerations; diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/ChoiceFieldScenariousTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/ChoiceFieldScenariousTest.cs index 04fedacd5..f9681ef21 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/ChoiceFieldScenariousTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/ChoiceFieldScenariousTest.cs @@ -4,7 +4,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using SPMeta2.Attributes.Regression; using SPMeta2.Containers; -using SPMeta2.CSOM.DefaultSyntax; + using SPMeta2.Definitions; using SPMeta2.Definitions.Fields; using SPMeta2.Enumerations; diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/DependentLookupFieldScenariousTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/DependentLookupFieldScenariousTest.cs index e80e63b28..5225bf964 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/DependentLookupFieldScenariousTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/DependentLookupFieldScenariousTest.cs @@ -4,7 +4,7 @@ using System.ComponentModel; using Microsoft.VisualStudio.TestTools.UnitTesting; using SPMeta2.Containers; -using SPMeta2.CSOM.DefaultSyntax; + using SPMeta2.Definitions; using SPMeta2.Definitions.ContentTypes; using SPMeta2.Definitions.Fields; @@ -16,6 +16,8 @@ using SPMeta2.Syntax.Default.Extensions; using SPMeta2.Syntax.Default.Modern; +using SPMeta2.Regression.Tests.Extensions; + namespace SPMeta2.Regression.Tests.Impl.Scenarios.Fields { [TestClass] @@ -126,14 +128,14 @@ public void CanDeploy_DependentLookupField_OnSite() list.AddListView(new ListViewDefinition { Title = "Test View", - Fields = new Collection - { - BuiltInInternalFieldNames.Edit, - BuiltInInternalFieldNames.ID, - BuiltInInternalFieldNames.Title, - lookupField.InternalName, - dependentIdLookupField.InternalName, - dependentTitleLookupField.InternalName + Fields = new Collection + { + BuiltInInternalFieldNames.Edit, + BuiltInInternalFieldNames.ID, + BuiltInInternalFieldNames.Title, + lookupField.InternalName, + dependentIdLookupField.InternalName, + dependentTitleLookupField.InternalName }, IsDefault = true }); @@ -249,9 +251,9 @@ public void CanDeploy_DependentLookupField_OnContentType() list.AddContentTypeLink(contentTypeWithDepLookup); list.AddUniqueContentTypeOrder(new UniqueContentTypeOrderDefinition { - ContentTypes = new List - { - new ContentTypeLinkValue { ContentTypeName = contentTypeWithDepLookup.Name } + ContentTypes = new List + { + new ContentTypeLinkValue { ContentTypeName = contentTypeWithDepLookup.Name } } }); @@ -261,14 +263,14 @@ public void CanDeploy_DependentLookupField_OnContentType() list.AddListView(new ListViewDefinition { Title = "Test View", - Fields = new Collection - { - BuiltInInternalFieldNames.Edit, - BuiltInInternalFieldNames.ID, - BuiltInInternalFieldNames.Title, - lookupField.InternalName, - dependentIdLookupField.InternalName, - dependentTitleLookupField.InternalName + Fields = new Collection + { + BuiltInInternalFieldNames.Edit, + BuiltInInternalFieldNames.ID, + BuiltInInternalFieldNames.Title, + lookupField.InternalName, + dependentIdLookupField.InternalName, + dependentTitleLookupField.InternalName }, IsDefault = true }); @@ -544,14 +546,14 @@ public void CanDeploy_DependentLookupField_OnList() list.AddListView(new ListViewDefinition { Title = "Test View", - Fields = new Collection - { - BuiltInInternalFieldNames.Edit, - BuiltInInternalFieldNames.ID, - BuiltInInternalFieldNames.Title, - lookupField.InternalName, - dependentIdLookupField.InternalName, - dependentTitleLookupField.InternalName + Fields = new Collection + { + BuiltInInternalFieldNames.Edit, + BuiltInInternalFieldNames.ID, + BuiltInInternalFieldNames.Title, + lookupField.InternalName, + dependentIdLookupField.InternalName, + dependentTitleLookupField.InternalName }, IsDefault = true }); diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/LookupFieldScenariousTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/LookupFieldScenariousTest.cs index 96a6a2841..85b3dfaa2 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/LookupFieldScenariousTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/LookupFieldScenariousTest.cs @@ -4,7 +4,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using SPMeta2.BuiltInDefinitions; using SPMeta2.Containers; -using SPMeta2.CSOM.DefaultSyntax; + using SPMeta2.Definitions; using SPMeta2.Definitions.Fields; using SPMeta2.Enumerations; @@ -15,7 +15,9 @@ using SPMeta2.Syntax.Default; using SPMeta2.Syntax.Default.Modern; using SPMeta2.Utils; -using SPMeta2.Definitions.ContentTypes; +using SPMeta2.Definitions.ContentTypes; + +using SPMeta2.Regression.Tests.Extensions; namespace SPMeta2.Regression.Tests.Impl.Scenarios.Fields { diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/OutcomeChoiceFieldScenariousTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/OutcomeChoiceFieldScenariousTest.cs index 2daca6f07..a3ac6de80 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/OutcomeChoiceFieldScenariousTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/OutcomeChoiceFieldScenariousTest.cs @@ -4,7 +4,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using SPMeta2.Attributes.Regression; using SPMeta2.Containers; -using SPMeta2.CSOM.DefaultSyntax; + using SPMeta2.Definitions; using SPMeta2.Definitions.Fields; using SPMeta2.Enumerations; diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/UserFieldScenariousTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/UserFieldScenariousTest.cs index 0c952a009..5af053c9b 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/UserFieldScenariousTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Fields/UserFieldScenariousTest.cs @@ -3,7 +3,7 @@ using System.Collections.ObjectModel; using Microsoft.VisualStudio.TestTools.UnitTesting; using SPMeta2.Containers; -using SPMeta2.CSOM.DefaultSyntax; + using SPMeta2.Definitions; using SPMeta2.Definitions.Fields; using SPMeta2.Enumerations; diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/ListItemScenariousTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/ListItemScenariousTest.cs index 6217ddf47..cbb31b25d 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/ListItemScenariousTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/ListItemScenariousTest.cs @@ -14,6 +14,7 @@ using SPMeta2.Regression.Tests.Prototypes; using SPMeta2.Standard.Definitions.Fields; using SPMeta2.Utils; +using SPMeta2.Regression.Utils; namespace SPMeta2.Regression.Tests.Impl.Scenarios @@ -41,7 +42,7 @@ public void SelfDiagnostic_AllFields_Should_Have_Value_Tests() targetTypes.AddRange(ReflectionUtils.GetTypesFromAssemblies(assemblies)); - Trace.WriteLine(string.Format("Found [{0}] fied types.", targetTypes.Count)); + RegressionUtils.WriteLine(string.Format("Found [{0}] fied types.", targetTypes.Count)); foreach (var fieldType in targetTypes.OrderBy(m => m.Name)) { @@ -61,13 +62,13 @@ public void SelfDiagnostic_AllFields_Should_Have_Value_Tests() if (!testExists2) isValid = false; - Trace.WriteLine(string.Format("[{0}] def: {1} one value test method: {2}", + RegressionUtils.WriteLine(string.Format("[{0}] def: {1} one value test method: {2}", testExists1, fullDefName, testName1)); - Trace.WriteLine(string.Format("[{0}] def: {1} multiple values test method: {2}", + RegressionUtils.WriteLine(string.Format("[{0}] def: {1} multiple values test method: {2}", testExists2, fullDefName, testName2)); - Trace.WriteLine(string.Empty); + RegressionUtils.WriteLine(string.Empty); } Assert.IsTrue(isValid); diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/ListScenariosTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/ListScenariosTest.cs index 57ef8e57f..2c2996739 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/ListScenariosTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/ListScenariosTest.cs @@ -12,12 +12,13 @@ using System.Text; using SPMeta2.BuiltInDefinitions; using SPMeta2.Containers.Services; -using SPMeta2.CSOM.DefaultSyntax; using SPMeta2.Syntax.Default; using SPMeta2.Syntax.Default.Modern; using SPMeta2.Syntax.Default.Utils; using SPMeta2.Exceptions; +using SPMeta2.Regression.Tests.Extensions; + namespace SPMeta2.Regression.Tests.Impl.Scenarios { [TestClass] @@ -727,6 +728,11 @@ public void CanDeploy_DocumentLibrary_With_WebCollectionToken_DocumentTemplateUr { var randomList = ModelGeneratorService.GetRandomDefinition(def => { + //def.EnableVersioning = true; + //def.EnableMinorVersions = true; + + //def.EnableModeration = true; + def.TemplateType = BuiltInListTemplateTypeId.DocumentLibrary; }); diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/ListViewScenariousTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/ListViewScenariousTest.cs index cdfeab1c5..a66b1ff1f 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/ListViewScenariousTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/ListViewScenariousTest.cs @@ -177,17 +177,18 @@ public void CanDeploy_ListView_AsDatasheetView() [TestMethod] [TestCategory("Regression.Scenarios.ListsViews.Types")] - [ExpectedException(typeof(SPMeta2NotImplementedException))] - public void CanDeploy_ListView_AsRecurrence() + public void CanDeploy_ListView_As_CalendarAndRecurrence() { + TestRandomDefinition(def => + { + def.Hidden = false; + def.Type = BuiltInViewType.Html; - throw new SPMeta2NotImplementedException(); - - //TestRandomDefinition(def => - //{ - // def.Hidden = false; - // def.Type = BuiltInViewType.Recurrence; - //}); + def.Types = new Collection(new string[]{ + BuiltInViewType.Calendar, + BuiltInViewType.Recurrence + }); + }); } #endregion @@ -307,6 +308,42 @@ public void CanDeploy_ListView_WithCustomUrl() #endregion + #region aggregations + + + [TestMethod] + [TestCategory("Regression.Scenarios.ListsViews.Aggregations")] + public void CanDeploy_ListView_With_Aggregation_TitleCount() + { + // Using Aggregations/AggregationsStatus in ListViewDefinition fails to deploy model (SSOM) #954 + // https://github.com/SubPointSolutions/spmeta2/issues/954 + // https://msdn.microsoft.com/en-us/library/office/ms468626.aspx + + TestRandomDefinition(def => + { + def.AggregationsStatus = BuiltInAggregationsStatus.On; + def.Aggregations = ""; + }); + } + + + [TestMethod] + [TestCategory("Regression.Scenarios.ListsViews.Aggregations")] + public void CanDeploy_ListView_With_Aggregation_TitleSum() + { + // Using Aggregations/AggregationsStatus in ListViewDefinition fails to deploy model (SSOM) #954 + // https://github.com/SubPointSolutions/spmeta2/issues/954 + // https://msdn.microsoft.com/en-us/library/office/ms468626.aspx + + TestRandomDefinition(def => + { + def.AggregationsStatus = BuiltInAggregationsStatus.On; + def.Aggregations = ""; + }); + } + + #endregion + #region localization [TestMethod] diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/ListViewWebPartScenariosTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/ListViewWebPartScenariosTest.cs index 12b6e4bd9..850377f44 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/ListViewWebPartScenariosTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/ListViewWebPartScenariosTest.cs @@ -9,7 +9,7 @@ using SPMeta2.Containers; using SPMeta2.Containers.Extensions; using SPMeta2.Containers.Standard; -using SPMeta2.CSOM.DefaultSyntax; + using SPMeta2.Definitions; using SPMeta2.Definitions.Webparts; using SPMeta2.Enumerations; @@ -19,7 +19,9 @@ using SPMeta2.Standard.Enumerations; using SPMeta2.Syntax.Default; using SPMeta2.Syntax.Default.Modern; -using SPMeta2.Definitions.Base; +using SPMeta2.Definitions.Base; + +using SPMeta2.Regression.Tests.Extensions; namespace SPMeta2.Regression.Tests.Impl.Scenarios { diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/SP2013WorkflowScenariosTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/SP2013WorkflowScenariosTest.cs index d8f00d5b1..06b7615e0 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/SP2013WorkflowScenariosTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/SP2013WorkflowScenariosTest.cs @@ -7,7 +7,7 @@ using SPMeta2.BuiltInDefinitions; using SPMeta2.Containers; using SPMeta2.Containers.Standard; -using SPMeta2.CSOM.DefaultSyntax; + using SPMeta2.Definitions; using SPMeta2.Enumerations; using SPMeta2.Models; @@ -15,7 +15,9 @@ using SPMeta2.Regression.Tests.Impl.Scenarios.Base; using SPMeta2.Standard.Definitions; using SPMeta2.Syntax.Default; -using SPMeta2.Validation.Validators.Relationships; +using SPMeta2.Validation.Validators.Relationships; + +using SPMeta2.Regression.Tests.Extensions; namespace SPMeta2.Regression.Tests.Impl.Scenarios { diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/SecurityGroupScenariosTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/SecurityGroupScenariosTest.cs index 1c4bcd263..0a26be533 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/SecurityGroupScenariosTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/SecurityGroupScenariosTest.cs @@ -1,129 +1,131 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using SPMeta2.BuiltInDefinitions; -using SPMeta2.Containers; -using SPMeta2.Containers.Standard; -using SPMeta2.Definitions; -using SPMeta2.Enumerations; -using SPMeta2.Models; -using SPMeta2.Regression.Tests.Base; -using SPMeta2.Regression.Tests.Definitions; -using SPMeta2.Regression.Tests.Impl.Scenarios.Base; -using SPMeta2.Syntax.Default; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using SPMeta2.Containers.Consts; -using SPMeta2.Containers.Services; -using SPMeta2.Containers.Utils; -using SPMeta2.Syntax.Default.Modern; - -namespace SPMeta2.Regression.Tests.Impl.Scenarios -{ - [TestClass] - public class SecurityGroupScenariosTest : SPMeta2RegresionScenarioTestBase - { - #region internal - - [ClassInitializeAttribute] - public static void Init(TestContext context) - { - InternalInit(); - } - - [ClassCleanupAttribute] - public static void Cleanup() - { - InternalCleanup(); - } - - #endregion - - #region security group - - [TestMethod] - [TestCategory("Regression.Scenarios.SecurityGroup")] - public void CanDeploy_SecurityGroup_Under_SecurityGroup() - { - var activeDirectoryOrGlobalO365Groups = RunnerEnvironmentUtils.GetEnvironmentVariable(EnvironmentConsts.DefaultTestADGroups) - .Split(','); - - var randomNestedGroup = Rnd.RandomFromArray(activeDirectoryOrGlobalO365Groups); - - var spGroup = ModelGeneratorService.GetRandomDefinition(); - var domainGroup = ModelGeneratorService.GetRandomDefinition(def => - { - def.Name = randomNestedGroup; - }); - - var siteModel = SPMeta2Model - .NewSiteModel(site => - { - site.AddSecurityGroup(spGroup, group => - { - group.AddSecurityGroup(domainGroup); - }); - }); - - TestModels(new ModelNode[] { siteModel }); - } - - - [TestMethod] - [TestCategory("Regression.Scenarios.SecurityGroup")] - public void CanDeploy_SecurityGroup_Owner_AsUser() - { - var securityGroup = ModelGeneratorService.GetRandomDefinition(); - - var siteModel = SPMeta2Model - .NewSiteModel(site => - { - securityGroup.Owner = Rnd.UserLogin(); - site.AddSecurityGroup(securityGroup); - }); - - TestModels(new ModelNode[] { siteModel }); - } - - [TestMethod] - [TestCategory("Regression.Scenarios.SecurityGroup")] - public void CanDeploy_SecurityGroup_Owner_AsSharePointGroup() - { - var ownerSecurityGroup = ModelGeneratorService.GetRandomDefinition(); - var securityGroup = ModelGeneratorService.GetRandomDefinition(def => - { - def.Owner = ownerSecurityGroup.Name; - }); - - var siteModel = SPMeta2Model - .NewSiteModel(site => - { - site.AddSecurityGroup(ownerSecurityGroup); - site.AddSecurityGroup(securityGroup); - }); - - TestModels(new ModelNode[] { siteModel }); - } - - - [TestMethod] - [TestCategory("Regression.Scenarios.SecurityGroup")] - public void CanDeploy_SecurityGroup_Owner_AsSelfGroup() - { - var securityGroup = ModelGeneratorService.GetRandomDefinition(def => - { - def.Owner = def.Name; - }); - - var siteModel = SPMeta2Model - .NewSiteModel(site => - { - site.AddSecurityGroup(securityGroup); - }); - - TestModels(new ModelNode[] { siteModel }); - } - - #endregion - } -} +using Microsoft.VisualStudio.TestTools.UnitTesting; +using SPMeta2.BuiltInDefinitions; +using SPMeta2.Containers; +using SPMeta2.Containers.Standard; +using SPMeta2.Definitions; +using SPMeta2.Enumerations; +using SPMeta2.Models; +using SPMeta2.Regression.Tests.Base; +using SPMeta2.Regression.Tests.Definitions; +using SPMeta2.Regression.Tests.Impl.Scenarios.Base; +using SPMeta2.Syntax.Default; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using SPMeta2.Containers.Consts; +using SPMeta2.Containers.Services; +using SPMeta2.Containers.Utils; +using SPMeta2.Syntax.Default.Modern; + +namespace SPMeta2.Regression.Tests.Impl.Scenarios +{ + [TestClass] + public class SecurityGroupScenariosTest : SPMeta2RegresionScenarioTestBase + { + #region internal + + [ClassInitializeAttribute] + public static void Init(TestContext context) + { + InternalInit(); + } + + [ClassCleanupAttribute] + public static void Cleanup() + { + InternalCleanup(); + } + + #endregion + + #region security group + + [TestMethod] + [TestCategory("Regression.Scenarios.SecurityGroup")] + public void CanDeploy_SecurityGroup_Under_SecurityGroup() + { + var activeDirectoryOrGlobalO365Groups = RunnerEnvironmentUtils.GetEnvironmentVariables(EnvironmentConsts.DefaultTestADGroups); + + if (activeDirectoryOrGlobalO365Groups.Count() == 0) + throw new Exception(string.Format("Environment variable [{0}] is null or empty", EnvironmentConsts.DefaultTestADGroups)); + + var randomNestedGroup = Rnd.RandomFromArray(activeDirectoryOrGlobalO365Groups); + + var spGroup = ModelGeneratorService.GetRandomDefinition(); + var domainGroup = ModelGeneratorService.GetRandomDefinition(def => + { + def.Name = randomNestedGroup; + }); + + var siteModel = SPMeta2Model + .NewSiteModel(site => + { + site.AddSecurityGroup(spGroup, group => + { + group.AddSecurityGroup(domainGroup); + }); + }); + + TestModels(new ModelNode[] { siteModel }); + } + + + [TestMethod] + [TestCategory("Regression.Scenarios.SecurityGroup")] + public void CanDeploy_SecurityGroup_Owner_AsUser() + { + var securityGroup = ModelGeneratorService.GetRandomDefinition(); + + var siteModel = SPMeta2Model + .NewSiteModel(site => + { + securityGroup.Owner = Rnd.UserLogin(); + site.AddSecurityGroup(securityGroup); + }); + + TestModels(new ModelNode[] { siteModel }); + } + + [TestMethod] + [TestCategory("Regression.Scenarios.SecurityGroup")] + public void CanDeploy_SecurityGroup_Owner_AsSharePointGroup() + { + var ownerSecurityGroup = ModelGeneratorService.GetRandomDefinition(); + var securityGroup = ModelGeneratorService.GetRandomDefinition(def => + { + def.Owner = ownerSecurityGroup.Name; + }); + + var siteModel = SPMeta2Model + .NewSiteModel(site => + { + site.AddSecurityGroup(ownerSecurityGroup); + site.AddSecurityGroup(securityGroup); + }); + + TestModels(new ModelNode[] { siteModel }); + } + + + [TestMethod] + [TestCategory("Regression.Scenarios.SecurityGroup")] + public void CanDeploy_SecurityGroup_Owner_AsSelfGroup() + { + var securityGroup = ModelGeneratorService.GetRandomDefinition(def => + { + def.Owner = def.Name; + }); + + var siteModel = SPMeta2Model + .NewSiteModel(site => + { + site.AddSecurityGroup(securityGroup); + }); + + TestModels(new ModelNode[] { siteModel }); + } + + #endregion + } +} diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/TaxonomyTermGroupScenariousTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/TaxonomyTermGroupScenariousTest.cs index b74fa9dfc..2f4104e04 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/TaxonomyTermGroupScenariousTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/TaxonomyTermGroupScenariousTest.cs @@ -1,154 +1,214 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using SPMeta2.BuiltInDefinitions; -using SPMeta2.Containers; -using SPMeta2.Containers.Standard; -using SPMeta2.Regression.Tests.Base; -using SPMeta2.Regression.Tests.Impl.Scenarios.Base; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using SPMeta2.Standard.Definitions.Taxonomy; -using SPMeta2.Standard.Syntax; -using SPMeta2.Syntax.Default; - -namespace SPMeta2.Regression.Tests.Impl.Scenarios -{ - [TestClass] - public class TaxonomyTermGroupScenariousTest : SPMeta2RegresionScenarioTestBase - { - #region internal - - [ClassInitializeAttribute] - public static void Init(TestContext context) - { - InternalInit(); - } - - [ClassCleanupAttribute] - public static void Cleanup() - { - InternalCleanup(); - } - - #endregion - - #region default - - [TestCategory("Regression.Scenarios.Taxonomy.TermGroup")] - [TestMethod] - public void CanDeploy_TaxonomyTermGroupByName() - { - var termGroup = ModelGeneratorService.GetRandomDefinition(def => - { - }); - - var model = SPMeta2Model - .NewSiteModel(site => - { - site - .AddRandomTermStore(store => - { - store.AddTaxonomyTermGroup(termGroup); - }); - }); - - TestModel(model); - } - - - [TestCategory("Regression.Scenarios.Taxonomy.TermGroup")] - [TestMethod] - public void CanDeploy_TaxonomyTermGroupByNameAndId() - { - var termGroup = ModelGeneratorService.GetRandomDefinition(def => - { - def.Id = Guid.NewGuid(); - }); - - var model = SPMeta2Model - .NewSiteModel(site => - { - site - .AddRandomTermStore(store => - { - store.AddTaxonomyTermGroup(termGroup); - }); - }); - - TestModel(model); - } - - #endregion - - #region system & default site group - - //[TestCategory("Regression.Scenarios.Taxonomy.TermGroup")] - //[TestMethod] - //public void CanDeploy_TaxonomyTermGroupAsSystem() - //{ - // Exception expectedException = null; - - // try - // { - // var termGroup = ModelGeneratorService.GetRandomDefinition(def => - // { - // def.IsSystemGroup = true; - // }); - - // var model = SPMeta2Model - // .NewSiteModel(site => - // { - // site - // .AddRandomTermStore(store => - // { - // store.AddTaxonomyTermGroup(termGroup, group => - // { - // group.AddRandomTermSet(); - // }); - // }); - // }); - - // TestModel(model); - // } - // catch (Exception ee) - // { - // expectedException = ee; - // } - - // // TODO - - // Assert.IsNotNull(expectedException); - // Assert.IsTrue(expectedException.GetType().Name == "TermStoreOperationException"); - // Assert.IsTrue(expectedException.Message.Contains("Creating a term set in system Group is disallowed")); - //} - - [TestCategory("Regression.Scenarios.Taxonomy.TermGroup")] - [TestMethod] - public void CanDeploy_TaxonomyTermGroupAsSiteCollectionGroup() - { - var termGroup = ModelGeneratorService.GetRandomDefinition(def => - { - def.IsSiteCollectionGroup = true; - }); - - var model = SPMeta2Model - .NewSiteModel(site => - { - site - .AddRandomTermStore(store => - { - store.AddTaxonomyTermGroup(termGroup, group => - { - group.AddRandomTermSet(); - }); - }); - }); - - TestModel(model); - } - - #endregion - } -} +using Microsoft.VisualStudio.TestTools.UnitTesting; +using SPMeta2.BuiltInDefinitions; +using SPMeta2.Containers; +using SPMeta2.Containers.Standard; +using SPMeta2.Regression.Tests.Base; +using SPMeta2.Regression.Tests.Impl.Scenarios.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using SPMeta2.Standard.Definitions.Taxonomy; +using SPMeta2.Standard.Syntax; +using SPMeta2.Syntax.Default; + +namespace SPMeta2.Regression.Tests.Impl.Scenarios +{ + [TestClass] + public class TaxonomyTermGroupScenariousTest : SPMeta2RegresionScenarioTestBase + { + #region internal + + [ClassInitializeAttribute] + public static void Init(TestContext context) + { + InternalInit(); + } + + [ClassCleanupAttribute] + public static void Cleanup() + { + InternalCleanup(); + } + + #endregion + + #region default + + [TestCategory("Regression.Scenarios.Taxonomy.TermGroup")] + [TestMethod] + public void CanDeploy_TaxonomyTermGroupByName() + { + var termGroup = ModelGeneratorService.GetRandomDefinition(def => + { + }); + + var model = SPMeta2Model + .NewSiteModel(site => + { + site + .AddRandomTermStore(store => + { + store.AddTaxonomyTermGroup(termGroup); + }); + }); + + TestModel(model); + } + + + [TestCategory("Regression.Scenarios.Taxonomy.TermGroup")] + [TestMethod] + public void CanDeploy_TaxonomyTermGroupByNameAndId() + { + var termGroup = ModelGeneratorService.GetRandomDefinition(def => + { + def.Id = Guid.NewGuid(); + }); + + var model = SPMeta2Model + .NewSiteModel(site => + { + site + .AddRandomTermStore(store => + { + store.AddTaxonomyTermGroup(termGroup); + }); + }); + + TestModel(model); + } + + #endregion + + #region system & default site group + + //[TestCategory("Regression.Scenarios.Taxonomy.TermGroup")] + //[TestMethod] + //public void CanDeploy_TaxonomyTermGroupAsSystem() + //{ + // Exception expectedException = null; + + // try + // { + // var termGroup = ModelGeneratorService.GetRandomDefinition(def => + // { + // def.IsSystemGroup = true; + // }); + + // var model = SPMeta2Model + // .NewSiteModel(site => + // { + // site + // .AddRandomTermStore(store => + // { + // store.AddTaxonomyTermGroup(termGroup, group => + // { + // group.AddRandomTermSet(); + // }); + // }); + // }); + + // TestModel(model); + // } + // catch (Exception ee) + // { + // expectedException = ee; + // } + + // // TODO + + // Assert.IsNotNull(expectedException); + // Assert.IsTrue(expectedException.GetType().Name == "TermStoreOperationException"); + // Assert.IsTrue(expectedException.Message.Contains("Creating a term set in system Group is disallowed")); + //} + + [TestCategory("Regression.Scenarios.Taxonomy.TermGroup")] + [TestMethod] + public void CanDeploy_TaxonomyTermGroup_As_SiteCollectionGroup() + { + var termGroup = ModelGeneratorService.GetRandomDefinition(def => + { + def.IsSiteCollectionGroup = true; + }); + + var model = SPMeta2Model + .NewSiteModel(site => + { + site + .AddRandomTermStore(store => + { + store.AddTaxonomyTermGroup(termGroup, group => + { + group.AddRandomTermSet(); + }); + }); + }); + + TestModel(model); + } + + [TestCategory("Regression.Scenarios.Taxonomy.TermGroup")] + [TestMethod] + public void CanDeploy_TaxonomyTermGroup_As_NonSiteCollectionGroup() + { + // woudn't work for O365 + var termGroup = ModelGeneratorService.GetRandomDefinition(def => + { + def.IsSiteCollectionGroup = false; + }); + + var model = SPMeta2Model + .NewSiteModel(site => + { + site + .AddRandomTermStore(store => + { + store.AddTaxonomyTermGroup(termGroup, group => + { + group.AddRandomTermSet(); + }); + }); + }); + + TestModel(model); + } + + [TestCategory("Regression.Scenarios.Taxonomy.TermGroup")] + [TestMethod] + public void CanDeploy_TaxonomyTermGroup_As_NonSiteCollectionGrou_SameNameAndId() + { + // woudn't work for O365 + // must be scoped for on-premis execution only + + // SPMeta2 Provisioning Taxonomy Group with CSOM Standard #959 + // https://github.com/SubPointSolutions/spmeta2/issues/959 + + var termGroup1 = ModelGeneratorService.GetRandomDefinition(def => + { + def.Name = Rnd.String(); + def.Id = Rnd.Guid(); + + def.IsSiteCollectionGroup = false; + }); + + var termGroup2 = termGroup1.Inherit(); + + var model = SPMeta2Model + .NewSiteModel(site => + { + site + .AddRandomTermStore(store => + { + store.AddTaxonomyTermGroup(termGroup1); + store.AddTaxonomyTermGroup(termGroup2); + }); + }); + + TestModel(model); + } + + #endregion + } +} diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/WebScenariosTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/WebScenariosTest.cs index 7f349218e..9d87bdf51 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/WebScenariosTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/WebScenariosTest.cs @@ -59,9 +59,8 @@ public void CanDeploy_Web_With_Slash_In_Url() [TestCategory("Regression.Scenarios.Webs.Templates")] public void CanDeploy_Custom_WebTemplate_As_SaveAsTemplate() { - // TODO // should be uploaded manually yet - var solution = new SandboxSolutionDefinition + var customWebAsTemplateSolution = new SandboxSolutionDefinition { FileName = Rnd.WspFileName(), Content = File.ReadAllBytes(DefaultContainers.WebTemplates.M2CustomWebAsTemplate.FilePath), @@ -69,6 +68,14 @@ public void CanDeploy_Custom_WebTemplate_As_SaveAsTemplate() SolutionId = DefaultContainers.WebTemplates.M2CustomWebAsTemplate.SolutionId }; + var customTeamSiteTemplateSolution = new SandboxSolutionDefinition + { + FileName = Rnd.WspFileName(), + Content = File.ReadAllBytes(DefaultContainers.WebTemplates.M2CustomTeamSite.FilePath), + Activate = true, + SolutionId = DefaultContainers.WebTemplates.M2CustomWebAsTemplate.SolutionId + }; + var mainWeb = ModelGeneratorService.GetRandomDefinition(def => { def.WebTemplate = string.Empty; diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Webparts/ContentByQueryWebPartScenariosTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Webparts/ContentByQueryWebPartScenariosTest.cs index f90e16ea9..54167ea55 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Webparts/ContentByQueryWebPartScenariosTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Webparts/ContentByQueryWebPartScenariosTest.cs @@ -6,8 +6,7 @@ using SPMeta2.Containers.Extensions; using SPMeta2.Containers.Services; using SPMeta2.Containers.Standard; -using SPMeta2.CSOM; -using SPMeta2.CSOM.DefaultSyntax; + using SPMeta2.Definitions; using SPMeta2.Definitions.Webparts; using SPMeta2.Regression.Tests.Definitions; diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Webparts/ContentEditorWebPartScenariosTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Webparts/ContentEditorWebPartScenariosTest.cs index 1e343c2d2..d54ad41e0 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Webparts/ContentEditorWebPartScenariosTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Webparts/ContentEditorWebPartScenariosTest.cs @@ -4,8 +4,8 @@ using SPMeta2.BuiltInDefinitions; using SPMeta2.Containers; using SPMeta2.Containers.Standard; -using SPMeta2.CSOM; -using SPMeta2.CSOM.DefaultSyntax; + + using SPMeta2.Definitions; using SPMeta2.Definitions.Webparts; using SPMeta2.Regression.Tests.Definitions; diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Webparts/XsltListViewWebPartScenariosTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Webparts/XsltListViewWebPartScenariosTest.cs index 14e3f61a5..5e79acfec 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Webparts/XsltListViewWebPartScenariosTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/Webparts/XsltListViewWebPartScenariosTest.cs @@ -6,8 +6,7 @@ using SPMeta2.Containers.Extensions; using SPMeta2.Containers.Services; using SPMeta2.Containers.Standard; -using SPMeta2.CSOM; -using SPMeta2.CSOM.DefaultSyntax; + using SPMeta2.Definitions; using SPMeta2.Definitions.Webparts; using SPMeta2.Regression.Tests.Definitions; @@ -347,11 +346,11 @@ public void CanDeploy_XsltListViewWebPart_ByViewId() var sourceList = ModelGeneratorService.GetRandomDefinition(def => { }); var sourceView = ModelGeneratorService.GetRandomDefinition(def => { - def.Fields = new System.Collections.ObjectModel.Collection - { - BuiltInInternalFieldNames.ID, - BuiltInInternalFieldNames.Edit, - BuiltInInternalFieldNames.Title + def.Fields = new System.Collections.ObjectModel.Collection + { + BuiltInInternalFieldNames.ID, + BuiltInInternalFieldNames.Edit, + BuiltInInternalFieldNames.Title }; def.IsDefault = false; @@ -407,11 +406,11 @@ public void CanDeploy_XsltListViewWebPart_ByViewName() var sourceList = ModelGeneratorService.GetRandomDefinition(def => { }); var sourceView = ModelGeneratorService.GetRandomDefinition(def => { - def.Fields = new System.Collections.ObjectModel.Collection - { - BuiltInInternalFieldNames.ID, - BuiltInInternalFieldNames.Edit, - BuiltInInternalFieldNames.Title + def.Fields = new System.Collections.ObjectModel.Collection + { + BuiltInInternalFieldNames.ID, + BuiltInInternalFieldNames.Edit, + BuiltInInternalFieldNames.Title }; def.IsDefault = false; @@ -461,11 +460,11 @@ public void CanDeploy_XsltListViewWebPart_ByViewUrl() var sourceList = ModelGeneratorService.GetRandomDefinition(def => { }); var sourceView = ModelGeneratorService.GetRandomDefinition(def => { - def.Fields = new System.Collections.ObjectModel.Collection - { - BuiltInInternalFieldNames.ID, - BuiltInInternalFieldNames.Edit, - BuiltInInternalFieldNames.Title + def.Fields = new System.Collections.ObjectModel.Collection + { + BuiltInInternalFieldNames.ID, + BuiltInInternalFieldNames.Edit, + BuiltInInternalFieldNames.Title }; def.Url = string.Format("{0}.aspx", Rnd.String()); @@ -782,10 +781,10 @@ public void CanDeploy_XsltListViewWebPart_On_WikiPage() .AddDefinitionNode(new WebpartPresenceOnPageDefinition { PageFileName = wikiPage.FileName, - WebPartDefinitions = new List(new WebPartDefinition[] - { - ceWebPart, - xsltWebPart + WebPartDefinitions = new List(new WebPartDefinition[] + { + ceWebPart, + xsltWebPart }) }, def => { diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/WorkflowAssociationScenariosTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/WorkflowAssociationScenariosTest.cs index 4d40857aa..2afaa7198 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/WorkflowAssociationScenariosTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Scenarios/WorkflowAssociationScenariosTest.cs @@ -14,7 +14,7 @@ using SPMeta2.BuiltInDefinitions; using SPMeta2.Containers.DefinitionGenerators; using SPMeta2.Containers.Services; -using SPMeta2.CSOM.DefaultSyntax; + using SPMeta2.Standard.Definitions.Fields; using SPMeta2.Syntax.Default; using SPMeta2.Syntax.Default.Modern; diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Services/DefaultRequiredPropertyValidationServiceTests.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Services/DefaultRequiredPropertyValidationServiceTests.cs index 4c39cec31..1b0c417bc 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Services/DefaultRequiredPropertyValidationServiceTests.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Services/DefaultRequiredPropertyValidationServiceTests.cs @@ -15,7 +15,8 @@ using SPMeta2.Services.Impl; using SPMeta2.Syntax.Default; using SPMeta2.Regression.Tests.Impl.Scenarios.Base; -using SPMeta2.Services.Impl.Validation; +using SPMeta2.Services.Impl.Validation; +using SPMeta2.Regression.Utils; namespace SPMeta2.Regression.Tests.Impl.Services { @@ -115,7 +116,7 @@ public void ShouldFail_On_Invalid_Field_Twice() foreach (var ex in (e.InnerException as AggregateException).InnerExceptions .OfType()) { - Trace.WriteLine("Ex: " + ex.Message + " N:" + ex.Definition); + RegressionUtils.WriteLine("Ex: " + ex.Message + " N:" + ex.Definition); } } diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Services/HashCodeServiceTests.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Services/HashCodeServiceTests.cs index 561ede39d..9c40d0f3a 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Services/HashCodeServiceTests.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Services/HashCodeServiceTests.cs @@ -7,7 +7,8 @@ using SPMeta2.Services.Impl; using SPMeta2.Standard.Definitions.Fields; using SPMeta2.Utils; -using System.Collections.Generic; +using System.Collections.Generic; +using SPMeta2.Regression.Utils; namespace SPMeta2.Regression.Tests.Impl.Services { @@ -35,14 +36,14 @@ public void CanGetHashForAllDefinitions() var hashes = new Dictionary(); - Trace.WriteLine("Checking hashes for definitions..."); + RegressionUtils.WriteLine("Checking hashes for definitions..."); foreach (var defType in allDefinitions) { var defInstance = ModelGeneratorService.GetRandomDefinition(defType); - Trace.WriteLine(string.Format("Definition:[{0}] - [{1}]", defType, defInstance)); + RegressionUtils.WriteLine(string.Format("Definition:[{0}] - [{1}]", defType, defInstance)); - TraceUtils.WithScope(trace => + IndentableTrace.WithScope(trace => { var hash1 = service.GetHashCode(defInstance); var hash2 = service.GetHashCode(defInstance); diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Syntax/TypedSyntaxTests.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Syntax/TypedSyntaxTests.cs index a20588efd..22b4031a9 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Syntax/TypedSyntaxTests.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Syntax/TypedSyntaxTests.cs @@ -79,6 +79,11 @@ public void CanPassTypedSyntax_SiteLevel() { site.AddSharePointDesignerSettings(new SharePointDesignerSettingsDefinition()); + site.AddRootWeb(new RootWebDefinition { }, rootWeb => + { + rootWeb.AddTopNavigationNode(new TopNavigationNodeDefinition()); + }); + site.AddCoreProperty(new CorePropertyDefinition()) .AddCoreProperty(new CorePropertyDefinition(), property => { diff --git a/SPMeta2/SPMeta2.Regression.Tests/Impl/Validation/EmptyDefinitionValidationTest.cs b/SPMeta2/SPMeta2.Regression.Tests/Impl/Validation/EmptyDefinitionValidationTest.cs index 009775778..808653ac8 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Impl/Validation/EmptyDefinitionValidationTest.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Impl/Validation/EmptyDefinitionValidationTest.cs @@ -133,7 +133,7 @@ public static ValidationPair AssertProperty( var result = source.ValidationResult; var prop = ReflectionUtils.GetExpressionValue(source.Model, exp); - TraceUtils.WithScope(s => + IndentableTrace.WithScope(s => { s.WriteLine(string.Format("Validating property: [{0}]", prop.Name)); diff --git a/SPMeta2/SPMeta2.Regression.Tests/PSScripts/200 - Configure M2 Test Environment.ps1 b/SPMeta2/SPMeta2.Regression.Tests/PSScripts/200 - Configure M2 Test Environment.ps1 index 89e73a39f..bfb0d0bc5 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/PSScripts/200 - Configure M2 Test Environment.ps1 +++ b/SPMeta2/SPMeta2.Regression.Tests/PSScripts/200 - Configure M2 Test Environment.ps1 @@ -12,5 +12,6 @@ M2ShowSettings $g_M2TestEnvironment # CSOM, SSOM, O365 #SetupSPMeta2RegressionTestEnvironment "SSOM" -SetupSPMeta2RegressionTestEnvironment "CSOM" -#SetupSPMeta2RegressionTestEnvironment "O365" \ No newline at end of file +#SetupSPMeta2RegressionTestEnvironment "CSOM" +#SetupSPMeta2RegressionTestEnvironment "O365" +SetupSPMeta2RegressionTestEnvironment "O365v16" \ No newline at end of file diff --git a/SPMeta2/SPMeta2.Regression.Tests/PSScripts/_config.ps1 b/SPMeta2/SPMeta2.Regression.Tests/PSScripts/_config.ps1 index 613b6a215..1b6b77efc 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/PSScripts/_config.ps1 +++ b/SPMeta2/SPMeta2.Regression.Tests/PSScripts/_config.ps1 @@ -52,15 +52,15 @@ $g_M2TestEnvironment = New-Object PSObject -Property @{ EnvironmentType = "SSOM" #O365 specific settings - O365UserName = "" - O365UserPassword = "" + O365UserName = "support@subpointsolutions.com" + O365UserPassword = "su1sbhsbhu8wxvKQ" O365SiteUrls = @( - "" + "https://subpointsolutions.sharepoint.com/sites/calc-col" ) O365WebUrls = @( - "" + "https://subpointsolutions.sharepoint.com/sites/calc-col" ) RandomBalancedUrls = @( diff --git a/SPMeta2/SPMeta2.Regression.Tests/PSScripts/_sys.common.ps1 b/SPMeta2/SPMeta2.Regression.Tests/PSScripts/_sys.common.ps1 index 544c40468..ae5897948 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/PSScripts/_sys.common.ps1 +++ b/SPMeta2/SPMeta2.Regression.Tests/PSScripts/_sys.common.ps1 @@ -312,7 +312,7 @@ function EnsureAssociatedGroups($web) { $envType = $g_M2TestEnvironment.EnvironmentType #$o365RuntimePath = "$PSScriptRoot\..\..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.3912.1204" -$o365RuntimePath = "$PSScriptRoot\..\..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200" +$o365RuntimePath = "$PSScriptRoot\..\..\SPMeta2.Dependencies\SharePoint\O365 - 16.1.5715.1200\NET45" $o365_UserName = $g_M2TestEnvironment.O365UserName $o365_UserPassword = $g_M2TestEnvironment.O365UserPassword diff --git a/SPMeta2/SPMeta2.Regression.Tests/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.Regression.Tests/Properties/AssemblyInfo.cs index 57e8ae2d9..187baa95f 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2.Regression.Tests/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.2.17040.0900")] +[assembly: AssemblyFileVersion("1.2.17057.1048")] diff --git a/SPMeta2/SPMeta2.Regression.Tests/SPMeta2.Regression.Tests.csproj b/SPMeta2/SPMeta2.Regression.Tests/SPMeta2.Regression.Tests.csproj index f296918fd..2f05e613a 100644 --- a/SPMeta2/SPMeta2.Regression.Tests/SPMeta2.Regression.Tests.csproj +++ b/SPMeta2/SPMeta2.Regression.Tests/SPMeta2.Regression.Tests.csproj @@ -99,6 +99,7 @@ + True @@ -135,6 +136,21 @@ Always + + Always + + + Always + + + Always + + + Always + + + Always + Always @@ -251,6 +267,8 @@ + + @@ -312,10 +330,6 @@ {091c48fb-27e3-4f84-897c-5de7bb55a2d3} SPMeta2.Containers - - {6f7ebf0c-7124-44d6-b9ec-302a54a19fe4} - SPMeta2.CSOM - {0DE538C9-1723-46B1-90F8-5DC67C56D7DD} SPMeta2.Regression @@ -338,7 +352,7 @@ SPMeta2.Containers.CSOM.dll Always - + SPMeta2.Containers.O365v16.dll Always @@ -350,12 +364,120 @@ SPMeta2.Containers.SSOM.dll Always + + _Dependencies\spmeta2-csom-365\SPMeta2.CSOM.dll + Always + + + _Dependencies\spmeta2-csom-365\SPMeta2.CSOM.Standard.dll + Always + - SPMeta2.CSOM.Standard.dll + _Dependencies\spmeta2-csom-2013\SPMeta2.CSOM.Standard.dll Always - SPMeta2.CSOM.dll + _Dependencies\spmeta2-csom-2013\SPMeta2.CSOM.dll + Always + + + _Dependencies\csom-v365\Microsoft.Office.Client.Policy.dll + Always + + + _Dependencies\csom-v365\Microsoft.Office.Client.TranslationServices.dll + Always + + + _Dependencies\csom-v365\Microsoft.Office.SharePoint.Tools.dll + Always + + + _Dependencies\csom-v365\Microsoft.Online.SharePoint.Client.Tenant.dll + Always + + + _Dependencies\csom-v365\Microsoft.ProjectServer.Client.dll + Always + + + _Dependencies\csom-v365\Microsoft.SharePoint.Client.dll + Always + + + _Dependencies\csom-v365\Microsoft.SharePoint.Client.DocumentManagement.dll + Always + + + _Dependencies\csom-v365\Microsoft.SharePoint.Client.Publishing.dll + Always + + + _Dependencies\csom-v365\Microsoft.SharePoint.Client.Runtime.dll + Always + + + _Dependencies\csom-v365\Microsoft.SharePoint.Client.Runtime.Windows.dll + Always + + + _Dependencies\csom-v365\Microsoft.SharePoint.Client.Search.Applications.dll + Always + + + _Dependencies\csom-v365\Microsoft.SharePoint.Client.Search.dll + Always + + + _Dependencies\csom-v365\Microsoft.SharePoint.Client.Taxonomy.dll + Always + + + _Dependencies\csom-v365\Microsoft.SharePoint.Client.UserProfiles.dll + Always + + + _Dependencies\csom-v365\Microsoft.SharePoint.Client.WorkflowServices.dll + Always + + + _Dependencies\csom-v2013\Microsoft.SharePoint.Client.dll + Always + + + _Dependencies\csom-v2013\Microsoft.SharePoint.Client.DocumentManagement.dll + Always + + + _Dependencies\csom-v2013\Microsoft.SharePoint.Client.Publishing.dll + Always + + + _Dependencies\csom-v2013\Microsoft.SharePoint.Client.Runtime.dll + Always + + + _Dependencies\csom-v2013\Microsoft.SharePoint.Client.Search.Applications.dll + Always + + + _Dependencies\csom-v2013\Microsoft.SharePoint.Client.Search.dll + Always + + + _Dependencies\csom-v2013\Microsoft.SharePoint.Client.ServerRuntime.dll + Always + + + _Dependencies\csom-v2013\Microsoft.SharePoint.Client.Taxonomy.dll + Always + + + _Dependencies\csom-v2013\Microsoft.SharePoint.Client.UserProfiles.dll + Always + + + _Dependencies\csom-v2013\Microsoft.SharePoint.Client.WorkflowServices.dll Always @@ -398,12 +520,20 @@ Microsoft.SharePoint.WorkflowServicesBase.dll Always + + _Dependencies\spmeta2-csom-regression-365\SPMeta2.Regression.CSOM.Standard.dll + Always + - SPMeta2.Regression.CSOM.Standard.dll + _Dependencies\spmeta2-csom-regression-2013\SPMeta2.Regression.CSOM.Standard.dll + Always + + + _Dependencies\spmeta2-csom-regression-365\SPMeta2.Regression.CSOM.dll Always - SPMeta2.Regression.CSOM.dll + _Dependencies\spmeta2-csom-regression-2013\SPMeta2.Regression.CSOM.dll Always @@ -422,6 +552,10 @@ SPMeta2.SSOM.dll Always + + SPMeta2.Standard.dll + Always + SPMeta2.dll Always diff --git a/SPMeta2/SPMeta2.Regression.Tests/Services/ExpectUpdateServices/ExpectUpdateAsEmailAddressService.cs b/SPMeta2/SPMeta2.Regression.Tests/Services/ExpectUpdateServices/ExpectUpdateAsEmailAddressService.cs new file mode 100644 index 000000000..0c186162f --- /dev/null +++ b/SPMeta2/SPMeta2.Regression.Tests/Services/ExpectUpdateServices/ExpectUpdateAsEmailAddressService.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using SPMeta2.Attributes.Regression; +using SPMeta2.Containers.Services; +using SPMeta2.Enumerations; + +namespace SPMeta2.Regression.Tests.Services.ExpectUpdateServices +{ + public class ExpectUpdateAsEmailAddressService : ExpectUpdateGenericService + { + public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop) + { + object newValue = string.Format("{0}@m2-regression-test.com", RndService.String()); + + return newValue; + } + } +} diff --git a/SPMeta2/SPMeta2.Regression.Tests/Services/ExpectUpdateServices/ExpectUpdateAsNumberFieldDisplayFormatService.cs b/SPMeta2/SPMeta2.Regression.Tests/Services/ExpectUpdateServices/ExpectUpdateAsNumberFieldDisplayFormatService.cs new file mode 100644 index 000000000..76fd3f6b2 --- /dev/null +++ b/SPMeta2/SPMeta2.Regression.Tests/Services/ExpectUpdateServices/ExpectUpdateAsNumberFieldDisplayFormatService.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using SPMeta2.Attributes.Regression; +using SPMeta2.Containers.Services; +using SPMeta2.Enumerations; + +namespace SPMeta2.Regression.Tests.Services.ExpectUpdateServices +{ + public class ExpectUpdateAsNumberFieldDisplayFormatService : ExpectUpdateGenericService + { + public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop) + { + object newValue = null; + + var values = new List(); + + values.Add(BuiltInNumberFormatTypes.Automatic); + + values.Add(BuiltInNumberFormatTypes.FiveDecimals); + values.Add(BuiltInNumberFormatTypes.FourDecimals); + values.Add(BuiltInNumberFormatTypes.ThreeDecimals); + values.Add(BuiltInNumberFormatTypes.TwoDecimals); + values.Add(BuiltInNumberFormatTypes.OneDecimal); + values.Add(BuiltInNumberFormatTypes.NoDecimal); + + newValue = RndService.RandomFromArray(values); + + return newValue; + } + } +} diff --git a/SPMeta2/SPMeta2.Regression/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.Regression/Properties/AssemblyInfo.cs index 5eff42421..6261cfc04 100644 --- a/SPMeta2/SPMeta2.Regression/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2.Regression/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.17040.0900")] +[assembly: AssemblyFileVersion("1.0.17057.1048")] diff --git a/SPMeta2/SPMeta2.Regression/SPMeta2.Regression.csproj b/SPMeta2/SPMeta2.Regression/SPMeta2.Regression.csproj index 878d96d86..f5aba1dc4 100644 --- a/SPMeta2/SPMeta2.Regression/SPMeta2.Regression.csproj +++ b/SPMeta2/SPMeta2.Regression/SPMeta2.Regression.csproj @@ -1,80 +1,76 @@ - - - - - Debug - AnyCPU - {0DE538C9-1723-46B1-90F8-5DC67C56D7DD} - Library - Properties - SPMeta2.Regression - SPMeta2.Regression - v4.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true - bin\CI-O365\ - DEBUG;TRACE - full - AnyCPU - prompt - MinimumRecommendedRules.ruleset - - - true - bin\CI-CSOM2013\ - DEBUG;TRACE - full - AnyCPU - prompt - MinimumRecommendedRules.ruleset - - - - - - - - - - - - - - - - - - - - {EE49D3FD-6180-40E6-829F-6831FF89DAC6} - SPMeta2 - - - + + + + + Debug + AnyCPU + {0DE538C9-1723-46B1-90F8-5DC67C56D7DD} + Library + Properties + SPMeta2.Regression + SPMeta2.Regression + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + bin\Debug45-$(spRuntime)\ + v4.5 + true + full + false + DEBUG;TRACE + prompt + 4 + false + bin\Debug45-$(spRuntime)\SPMeta2.Regression.XML + + + + + + + + + + + + + + + + + + + + + + {EE49D3FD-6180-40E6-829F-6831FF89DAC6} + SPMeta2 + + + + --> \ No newline at end of file diff --git a/SPMeta2/SPMeta2.Regression/Service/RegressionTraceService.cs b/SPMeta2/SPMeta2.Regression/Service/RegressionTraceService.cs new file mode 100644 index 000000000..5438dda32 --- /dev/null +++ b/SPMeta2/SPMeta2.Regression/Service/RegressionTraceService.cs @@ -0,0 +1,138 @@ +using SPMeta2.Services; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SPMeta2.Regression.Service +{ + public class RegressionTraceService : TraceServiceBase + { + #region consturctors + + public RegressionTraceService() + { + IsVerboseEnabled = false; + + IsInformationEnabled = true; + IsWarningEnabled = true; + IsErrorEnabled = true; + IsCriticalEnabled = true; + + var fileName = string.Format("spmeta2.regression.{0}.log", GetTimestamp()); + LogFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fileName); + } + + #endregion + + #region classes + + protected enum Level + { + Critical, + Error, + Warning, + Information, + Verbose + } + + #endregion + + #region props + + public bool IsVerboseEnabled { get; set; } + public bool IsInformationEnabled { get; set; } + public bool IsWarningEnabled { get; set; } + public bool IsErrorEnabled { get; set; } + public bool IsCriticalEnabled { get; set; } + + public string LogFilePath { get; set; } + + #endregion + + #region methods + + protected virtual String GetTimestamp() + { + return (DateTime.Now).ToString("yyyyMMdd_HHmmssfff"); + } + + protected virtual void InternalWrite(Level level, string message) + { + var internalMessgae = string.Format("[{0}]: {1}", level, message); + + Trace.WriteLine(internalMessgae); + Debug.WriteLine(internalMessgae); + + using (StreamWriter sw = File.AppendText(LogFilePath)) + sw.WriteLine(internalMessgae); + } + + public override void Critical(int id, object message, Exception exception) + { + if (IsCriticalEnabled) + InternalWrite(Level.Critical, message + ((exception != null) ? exception.ToString() : string.Empty)); + } + + public override void Error(int id, object message, Exception exception) + { + if (IsErrorEnabled) + InternalWrite(Level.Error, message + ((exception != null) ? exception.ToString() : string.Empty)); + } + + public override void Warning(int id, object message, Exception exception) + { + if (IsWarningEnabled) + InternalWrite(Level.Warning, message + ((exception != null) ? exception.ToString() : string.Empty)); + } + + public override void Information(int id, object message, Exception exception) + { + if (IsInformationEnabled) + InternalWrite(Level.Information, message + ((exception != null) ? exception.ToString() : string.Empty)); + } + + public override void Verbose(int id, object message, Exception exception) + { + if (IsVerboseEnabled) + InternalWrite(Level.Verbose, message + ((exception != null) ? exception.ToString() : string.Empty)); + } + + public override void TraceActivityStart(int id, object message) + { + + } + + public override void TraceActivityStop(int id, object message) + { + + } + + public override void TraceActivityTransfer(int id, object message, Guid relatedActivityId) + { + + } + + + private Guid? _currentActivityId; + + public override Guid CurrentActivityId + { + get + { + if (_currentActivityId == null) + _currentActivityId = Guid.NewGuid(); + + return _currentActivityId.Value; + } + set + { + _currentActivityId = value; + } + } + #endregion + } +} diff --git a/SPMeta2/SPMeta2.Regression/Utils/RegressionTrace.cs b/SPMeta2/SPMeta2.Regression/Utils/RegressionTrace.cs new file mode 100644 index 000000000..7e9e8c033 --- /dev/null +++ b/SPMeta2/SPMeta2.Regression/Utils/RegressionTrace.cs @@ -0,0 +1,33 @@ +using SPMeta2.Regression.Service; +using SPMeta2.Services; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SPMeta2.Regression.Utils +{ + public static class RegressionUtils + { + #region static + + static RegressionUtils() + { + // replace and redirect all global trace for the regression + ServiceContainer.Instance.ReplaceService(typeof(TraceServiceBase), new RegressionTraceService()); + } + + #endregion + + #region methods + + public static void WriteLine(string message) + { + var m2logService = ServiceContainer.Instance.GetService(); + m2logService.Information(0, message); + } + + #endregion + } +} diff --git a/SPMeta2/SPMeta2.SSOM.Standard/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.SSOM.Standard/Properties/AssemblyInfo.cs index 0b7936084..a09b27b4f 100644 --- a/SPMeta2/SPMeta2.SSOM.Standard/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2.SSOM.Standard/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.2.17040.0900")] +[assembly: AssemblyFileVersion("1.2.17057.1048")] diff --git a/SPMeta2/SPMeta2.SSOM/ModelHandlers/Fields/NumberFieldModelHandler.cs b/SPMeta2/SPMeta2.SSOM/ModelHandlers/Fields/NumberFieldModelHandler.cs index f3e358d87..4a98bcc24 100644 --- a/SPMeta2/SPMeta2.SSOM/ModelHandlers/Fields/NumberFieldModelHandler.cs +++ b/SPMeta2/SPMeta2.SSOM/ModelHandlers/Fields/NumberFieldModelHandler.cs @@ -1,97 +1,99 @@ -using System; -using System.Xml.Linq; -using Microsoft.SharePoint; -using SPMeta2.Definitions; -using SPMeta2.Definitions.Fields; -using SPMeta2.Enumerations; -using SPMeta2.Utils; - -namespace SPMeta2.SSOM.ModelHandlers.Fields -{ - public class NumberFieldModelHandler : FieldModelHandler - { - #region properties - - public override Type TargetType - { - get { return typeof(NumberFieldDefinition); } - } - - protected override Type GetTargetFieldType(FieldDefinition model) - { - return typeof(SPFieldNumber); - } - - #endregion - - #region methods - - protected override void ProcessFieldProperties(SPField field, FieldDefinition fieldModel) - { - // let base setting be setup - base.ProcessFieldProperties(field, fieldModel); - - if (!string.IsNullOrEmpty(fieldModel.ValidationMessage)) - field.ValidationMessage = fieldModel.ValidationMessage; - - if (!string.IsNullOrEmpty(fieldModel.ValidationFormula)) - field.ValidationFormula = fieldModel.ValidationFormula; - - var typedFieldModel = fieldModel.WithAssertAndCast("model", value => value.RequireNotNull()); - var typedField = field as SPFieldNumber; - - if (typedFieldModel.MinimumValue.HasValue) - typedField.MinimumValue = typedFieldModel.MinimumValue.Value; - - if (typedFieldModel.MaximumValue.HasValue) - typedField.MaximumValue = typedFieldModel.MaximumValue.Value; - - typedField.ShowAsPercentage = typedFieldModel.ShowAsPercentage; - } - - protected override void ProcessSPFieldXElement(XElement fieldTemplate, FieldDefinition fieldModel) - { - base.ProcessSPFieldXElement(fieldTemplate, fieldModel); - - var typedFieldModel = fieldModel.WithAssertAndCast("model", value => value.RequireNotNull()); - - if (typedFieldModel.MinimumValue.HasValue) - fieldTemplate.SetAttribute(BuiltInFieldAttributes.Min, typedFieldModel.MinimumValue); - - if (typedFieldModel.MaximumValue.HasValue) - fieldTemplate.SetAttribute(BuiltInFieldAttributes.Max, typedFieldModel.MaximumValue); - - fieldTemplate.SetAttribute(BuiltInFieldAttributes.Percentage, typedFieldModel.ShowAsPercentage.ToString().ToUpper()); - - fieldTemplate.SetAttribute(BuiltInFieldAttributes.Decimals, GetDecimalsValue(typedFieldModel.DisplayFormat)); - } - - internal static int GetDecimalsValue(string value) - { - if (value == BuiltInNumberFormatTypes.Automatic) - return -1; - - if (value == BuiltInNumberFormatTypes.NoDecimal) - return 0; - - if (value == BuiltInNumberFormatTypes.OneDecimal) - return 1; - - if (value == BuiltInNumberFormatTypes.TwoDecimals) - return 2; - - if (value == BuiltInNumberFormatTypes.ThreeDecimals) - return 3; - - if (value == BuiltInNumberFormatTypes.FourDecimals) - return 4; - - if (value == BuiltInNumberFormatTypes.FiveDecimals) - return 5; - - throw new ArgumentException("DisplayFormat"); - } - - #endregion - } -} +using System; +using System.Xml.Linq; +using Microsoft.SharePoint; +using SPMeta2.Definitions; +using SPMeta2.Definitions.Fields; +using SPMeta2.Enumerations; +using SPMeta2.Utils; + +namespace SPMeta2.SSOM.ModelHandlers.Fields +{ + public class NumberFieldModelHandler : FieldModelHandler + { + #region properties + + public override Type TargetType + { + get { return typeof(NumberFieldDefinition); } + } + + protected override Type GetTargetFieldType(FieldDefinition model) + { + return typeof(SPFieldNumber); + } + + #endregion + + #region methods + + protected override void ProcessFieldProperties(SPField field, FieldDefinition fieldModel) + { + // let base setting be setup + base.ProcessFieldProperties(field, fieldModel); + + if (!string.IsNullOrEmpty(fieldModel.ValidationMessage)) + field.ValidationMessage = fieldModel.ValidationMessage; + + if (!string.IsNullOrEmpty(fieldModel.ValidationFormula)) + field.ValidationFormula = fieldModel.ValidationFormula; + + var typedFieldModel = fieldModel.WithAssertAndCast("model", value => value.RequireNotNull()); + var typedField = field as SPFieldNumber; + + if (typedFieldModel.MinimumValue.HasValue) + typedField.MinimumValue = typedFieldModel.MinimumValue.Value; + + if (typedFieldModel.MaximumValue.HasValue) + typedField.MaximumValue = typedFieldModel.MaximumValue.Value; + + if (!string.IsNullOrEmpty(typedFieldModel.DisplayFormat)) + typedField.DisplayFormat = (SPNumberFormatTypes)Enum.Parse(typeof(SPNumberFormatTypes), typedFieldModel.DisplayFormat); + + typedField.ShowAsPercentage = typedFieldModel.ShowAsPercentage; + } + + protected override void ProcessSPFieldXElement(XElement fieldTemplate, FieldDefinition fieldModel) + { + base.ProcessSPFieldXElement(fieldTemplate, fieldModel); + + var typedFieldModel = fieldModel.WithAssertAndCast("model", value => value.RequireNotNull()); + + if (typedFieldModel.MinimumValue.HasValue) + fieldTemplate.SetAttribute(BuiltInFieldAttributes.Min, typedFieldModel.MinimumValue); + + if (typedFieldModel.MaximumValue.HasValue) + fieldTemplate.SetAttribute(BuiltInFieldAttributes.Max, typedFieldModel.MaximumValue); + + fieldTemplate.SetAttribute(BuiltInFieldAttributes.Percentage, typedFieldModel.ShowAsPercentage.ToString().ToUpper()); + fieldTemplate.SetAttribute(BuiltInFieldAttributes.Decimals, GetDecimalsValue(typedFieldModel.DisplayFormat)); + } + + internal static int GetDecimalsValue(string value) + { + if (value == BuiltInNumberFormatTypes.Automatic) + return -1; + + if (value == BuiltInNumberFormatTypes.NoDecimal) + return 0; + + if (value == BuiltInNumberFormatTypes.OneDecimal) + return 1; + + if (value == BuiltInNumberFormatTypes.TwoDecimals) + return 2; + + if (value == BuiltInNumberFormatTypes.ThreeDecimals) + return 3; + + if (value == BuiltInNumberFormatTypes.FourDecimals) + return 4; + + if (value == BuiltInNumberFormatTypes.FiveDecimals) + return 5; + + throw new ArgumentException("DisplayFormat"); + } + + #endregion + } +} diff --git a/SPMeta2/SPMeta2.SSOM/ModelHandlers/ListViewModelHandler.cs b/SPMeta2/SPMeta2.SSOM/ModelHandlers/ListViewModelHandler.cs index e8d1b407e..8ece244ca 100644 --- a/SPMeta2/SPMeta2.SSOM/ModelHandlers/ListViewModelHandler.cs +++ b/SPMeta2/SPMeta2.SSOM/ModelHandlers/ListViewModelHandler.cs @@ -153,6 +153,27 @@ protected void ProcessView(object modelHost, SPList targetList, ListViewDefiniti var viewType = (SPViewCollection.SPViewType)Enum.Parse(typeof(SPViewCollection.SPViewType), string.IsNullOrEmpty(listViewModel.Type) ? BuiltInViewType.Html : listViewModel.Type); + // nasty hack + + // The provision of calendars is not working properly #935 + // https://github.com/SubPointSolutions/spmeta2/issues/935 + if (listViewModel.Types.Count() > 0) + { + SPViewCollection.SPViewType? finalType = null; + + foreach (var type in listViewModel.Types) + { + var tmpViewType = (SPViewCollection.SPViewType)Enum.Parse(typeof(SPViewCollection.SPViewType), type); + + if (finalType == null) + finalType = tmpViewType; + else + finalType = finalType | tmpViewType; + } + + viewType = finalType.Value; + } + // TODO, handle personal view creation currentView = targetList.Views.Add( string.IsNullOrEmpty(listViewModel.Url) ? listViewModel.Title : GetSafeViewUrl(listViewModel.Url), @@ -219,10 +240,10 @@ private void MapProperties(SPList targetList, SPView currentView, ListViewDefini // There is no value in setting Aggregations if AggregationsStatus is not to "On" if (!string.IsNullOrEmpty(listViewModel.AggregationsStatus) && listViewModel.AggregationsStatus == "On") { - currentView.AggregationsStatus = listViewModel.AggregationsStatus; - if (!string.IsNullOrEmpty(listViewModel.Aggregations)) currentView.Aggregations = listViewModel.Aggregations; + + currentView.AggregationsStatus = listViewModel.AggregationsStatus; } currentView.Hidden = listViewModel.Hidden; diff --git a/SPMeta2/SPMeta2.SSOM/ModelHandlers/SP2013WorkflowDefinitionHandler.cs b/SPMeta2/SPMeta2.SSOM/ModelHandlers/SP2013WorkflowDefinitionHandler.cs index 7f933c6d0..1ab3b2b01 100644 --- a/SPMeta2/SPMeta2.SSOM/ModelHandlers/SP2013WorkflowDefinitionHandler.cs +++ b/SPMeta2/SPMeta2.SSOM/ModelHandlers/SP2013WorkflowDefinitionHandler.cs @@ -1,163 +1,169 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Microsoft.SharePoint; -using Microsoft.SharePoint.WorkflowServices; -using SPMeta2.Common; -using SPMeta2.Definitions; -using SPMeta2.Definitions.Base; -using SPMeta2.Services; -using SPMeta2.SSOM.ModelHosts; -using SPMeta2.Utils; - -namespace SPMeta2.SSOM.ModelHandlers -{ - public class SP2013WorkflowDefinitionHandler : SSOMModelHandlerBase - { - #region properties - - public override Type TargetType - { - get { return typeof(SP2013WorkflowDefinition); } - } - - #endregion - - #region methods - - public override void DeployModel(object modelHost, DefinitionBase model) - { - var webModelHost = modelHost.WithAssertAndCast("modelHost", value => value.RequireNotNull()); - var web = webModelHost.HostWeb; - - var workflowDefinitionModel = model.WithAssertAndCast("model", value => value.RequireNotNull()); - - DeployWorkflowDefinition(modelHost, web, workflowDefinitionModel); - } - - protected WorkflowDefinition GetCurrentWorkflowDefinition(SPWeb web, - SP2013WorkflowDefinition workflowDefinitionModel) - { - var workflowServiceManager = new WorkflowServicesManager(web); - var workflowDeploymentService = workflowServiceManager.GetWorkflowDeploymentService(); - - var publishedWorkflows = workflowDeploymentService.EnumerateDefinitions(false); - return publishedWorkflows.FirstOrDefault(w => w.DisplayName == workflowDefinitionModel.DisplayName); - } - - private void DeployWorkflowDefinition(object host, SPWeb web, SP2013WorkflowDefinition workflowDefinitionModel) - { - var workflowServiceManager = new WorkflowServicesManager(web); - var workflowDeploymentService = workflowServiceManager.GetWorkflowDeploymentService(); - - var currentWorkflowDefinition = GetCurrentWorkflowDefinition(web, workflowDefinitionModel); - - InvokeOnModelEvent(this, new ModelEventArgs - { - CurrentModelNode = null, - Model = null, - EventType = ModelEventType.OnProvisioning, - Object = currentWorkflowDefinition, - ObjectType = typeof(WorkflowDefinition), - ObjectDefinition = workflowDefinitionModel, - ModelHost = host - }); - - if (currentWorkflowDefinition == null) - { - TraceService.Information((int)LogEventId.ModelProvisionProcessingNewObject, "Processing new SP2013 workflow definition"); - - var workflowDefinition = new WorkflowDefinition() - { - Xaml = workflowDefinitionModel.Xaml, - DisplayName = workflowDefinitionModel.DisplayName - }; - - MapProperties(workflowDefinition, workflowDefinitionModel); - - TraceService.Verbose((int)LogEventId.ModelProvisionCoreCall, "Calling SaveDefinition()"); - var wfId = workflowDeploymentService.SaveDefinition(workflowDefinition); - - InvokeOnModelEvent(this, new ModelEventArgs - { - CurrentModelNode = null, - Model = null, - EventType = ModelEventType.OnProvisioned, - Object = workflowDefinition, - ObjectType = typeof(WorkflowDefinition), - ObjectDefinition = workflowDefinitionModel, - ModelHost = host - }); - - TraceService.Verbose((int)LogEventId.ModelProvisionCoreCall, "Calling PublishDefinition()"); - workflowDeploymentService.PublishDefinition(wfId); - } - else - { - TraceService.Information((int)LogEventId.ModelProvisionProcessingExistingObject, "Processing existing SP2013 workflow definition"); - - if (workflowDefinitionModel.Override) - { - TraceService.Verbose((int)LogEventId.ModelProvisionCoreCall, "Override = true. Overriding workflow definition"); - - currentWorkflowDefinition.Xaml = workflowDefinitionModel.Xaml; - - MapProperties(currentWorkflowDefinition, workflowDefinitionModel); - - InvokeOnModelEvent(this, new ModelEventArgs - { - CurrentModelNode = null, - Model = null, - EventType = ModelEventType.OnProvisioned, - Object = currentWorkflowDefinition, - ObjectType = typeof(WorkflowDefinition), - ObjectDefinition = workflowDefinitionModel, - ModelHost = host - }); - - TraceService.Verbose((int)LogEventId.ModelProvisionCoreCall, "Calling SaveDefinition()"); - var wfId = workflowDeploymentService.SaveDefinition(currentWorkflowDefinition); - - TraceService.Verbose((int)LogEventId.ModelProvisionCoreCall, "Calling PublishDefinition()"); - workflowDeploymentService.PublishDefinition(wfId); - } - else - { - TraceService.Verbose((int)LogEventId.ModelProvisionCoreCall, "Override = false. Skipping workflow definition"); - - MapProperties(currentWorkflowDefinition, workflowDefinitionModel); - - InvokeOnModelEvent(this, new ModelEventArgs - { - CurrentModelNode = null, - Model = null, - EventType = ModelEventType.OnProvisioned, - Object = currentWorkflowDefinition, - ObjectType = typeof(WorkflowDefinition), - ObjectDefinition = workflowDefinitionModel, - ModelHost = host - }); - - TraceService.Verbose((int)LogEventId.ModelProvisionCoreCall, "Calling PublishDefinition()"); - workflowDeploymentService.PublishDefinition(currentWorkflowDefinition.Id); - } - } - } - - protected virtual void MapProperties(WorkflowDefinition workflow, SP2013WorkflowDefinition definition) - { - if (!string.IsNullOrEmpty(definition.RestrictToType)) - workflow.RestrictToType = definition.RestrictToType; - - if (!string.IsNullOrEmpty(definition.RestrictToScope)) - workflow.RestrictToScope = definition.RestrictToScope; - - foreach (var prop in definition.Properties) - workflow.SetProperty(prop.Name, prop.Value); - } - - #endregion - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Microsoft.SharePoint; +using Microsoft.SharePoint.WorkflowServices; +using SPMeta2.Common; +using SPMeta2.Definitions; +using SPMeta2.Definitions.Base; +using SPMeta2.Services; +using SPMeta2.SSOM.ModelHosts; +using SPMeta2.Utils; +using SPMeta2.Exceptions; + +namespace SPMeta2.SSOM.ModelHandlers +{ + public class SP2013WorkflowDefinitionHandler : SSOMModelHandlerBase + { + #region properties + + public override Type TargetType + { + get { return typeof(SP2013WorkflowDefinition); } + } + + #endregion + + #region methods + + public override void DeployModel(object modelHost, DefinitionBase model) + { + var webModelHost = modelHost.WithAssertAndCast("modelHost", value => value.RequireNotNull()); + var web = webModelHost.HostWeb; + + var workflowDefinitionModel = model.WithAssertAndCast("model", value => value.RequireNotNull()); + + DeployWorkflowDefinition(modelHost, web, workflowDefinitionModel); + } + + protected WorkflowDefinition GetCurrentWorkflowDefinition(SPWeb web, + SP2013WorkflowDefinition workflowDefinitionModel) + { + var workflowServiceManager = new WorkflowServicesManager(web); + var workflowDeploymentService = workflowServiceManager.GetWorkflowDeploymentService(); + + var publishedWorkflows = workflowDeploymentService.EnumerateDefinitions(false); + return publishedWorkflows.FirstOrDefault(w => w.DisplayName == workflowDefinitionModel.DisplayName); + } + + private void DeployWorkflowDefinition(object host, SPWeb web, SP2013WorkflowDefinition workflowDefinitionModel) + { + var workflowServiceManager = new WorkflowServicesManager(web); + var workflowDeploymentService = workflowServiceManager.GetWorkflowDeploymentService(); + + if (workflowDeploymentService == null) + { + throw new SPMeta2Exception("WorkflowServicesManager.GetWorkflowDeploymentService() returned NULL. Ensure SharePoint 2013 workflow configuration."); + } + + var currentWorkflowDefinition = GetCurrentWorkflowDefinition(web, workflowDefinitionModel); + + InvokeOnModelEvent(this, new ModelEventArgs + { + CurrentModelNode = null, + Model = null, + EventType = ModelEventType.OnProvisioning, + Object = currentWorkflowDefinition, + ObjectType = typeof(WorkflowDefinition), + ObjectDefinition = workflowDefinitionModel, + ModelHost = host + }); + + if (currentWorkflowDefinition == null) + { + TraceService.Information((int)LogEventId.ModelProvisionProcessingNewObject, "Processing new SP2013 workflow definition"); + + var workflowDefinition = new WorkflowDefinition() + { + Xaml = workflowDefinitionModel.Xaml, + DisplayName = workflowDefinitionModel.DisplayName + }; + + MapProperties(workflowDefinition, workflowDefinitionModel); + + TraceService.Verbose((int)LogEventId.ModelProvisionCoreCall, "Calling SaveDefinition()"); + var wfId = workflowDeploymentService.SaveDefinition(workflowDefinition); + + InvokeOnModelEvent(this, new ModelEventArgs + { + CurrentModelNode = null, + Model = null, + EventType = ModelEventType.OnProvisioned, + Object = workflowDefinition, + ObjectType = typeof(WorkflowDefinition), + ObjectDefinition = workflowDefinitionModel, + ModelHost = host + }); + + TraceService.Verbose((int)LogEventId.ModelProvisionCoreCall, "Calling PublishDefinition()"); + workflowDeploymentService.PublishDefinition(wfId); + } + else + { + TraceService.Information((int)LogEventId.ModelProvisionProcessingExistingObject, "Processing existing SP2013 workflow definition"); + + if (workflowDefinitionModel.Override) + { + TraceService.Verbose((int)LogEventId.ModelProvisionCoreCall, "Override = true. Overriding workflow definition"); + + currentWorkflowDefinition.Xaml = workflowDefinitionModel.Xaml; + + MapProperties(currentWorkflowDefinition, workflowDefinitionModel); + + InvokeOnModelEvent(this, new ModelEventArgs + { + CurrentModelNode = null, + Model = null, + EventType = ModelEventType.OnProvisioned, + Object = currentWorkflowDefinition, + ObjectType = typeof(WorkflowDefinition), + ObjectDefinition = workflowDefinitionModel, + ModelHost = host + }); + + TraceService.Verbose((int)LogEventId.ModelProvisionCoreCall, "Calling SaveDefinition()"); + var wfId = workflowDeploymentService.SaveDefinition(currentWorkflowDefinition); + + TraceService.Verbose((int)LogEventId.ModelProvisionCoreCall, "Calling PublishDefinition()"); + workflowDeploymentService.PublishDefinition(wfId); + } + else + { + TraceService.Verbose((int)LogEventId.ModelProvisionCoreCall, "Override = false. Skipping workflow definition"); + + MapProperties(currentWorkflowDefinition, workflowDefinitionModel); + + InvokeOnModelEvent(this, new ModelEventArgs + { + CurrentModelNode = null, + Model = null, + EventType = ModelEventType.OnProvisioned, + Object = currentWorkflowDefinition, + ObjectType = typeof(WorkflowDefinition), + ObjectDefinition = workflowDefinitionModel, + ModelHost = host + }); + + TraceService.Verbose((int)LogEventId.ModelProvisionCoreCall, "Calling PublishDefinition()"); + workflowDeploymentService.PublishDefinition(currentWorkflowDefinition.Id); + } + } + } + + protected virtual void MapProperties(WorkflowDefinition workflow, SP2013WorkflowDefinition definition) + { + if (!string.IsNullOrEmpty(definition.RestrictToType)) + workflow.RestrictToType = definition.RestrictToType; + + if (!string.IsNullOrEmpty(definition.RestrictToScope)) + workflow.RestrictToScope = definition.RestrictToScope; + + foreach (var prop in definition.Properties) + workflow.SetProperty(prop.Name, prop.Value); + } + + #endregion + } +} diff --git a/SPMeta2/SPMeta2.SSOM/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.SSOM/Properties/AssemblyInfo.cs index 995e6625d..a75802b8f 100644 --- a/SPMeta2/SPMeta2.SSOM/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2.SSOM/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.2.17040.0900")] +[assembly: AssemblyFileVersion("1.2.17057.1048")] diff --git a/SPMeta2/SPMeta2.SSOM/Services/SSOMTokenReplacementService.cs b/SPMeta2/SPMeta2.SSOM/Services/SSOMTokenReplacementService.cs index a4da71e52..8c7358d06 100644 --- a/SPMeta2/SPMeta2.SSOM/Services/SSOMTokenReplacementService.cs +++ b/SPMeta2/SPMeta2.SSOM/Services/SSOMTokenReplacementService.cs @@ -67,10 +67,39 @@ public override TokenReplacementResult ReplaceTokens(TokenReplacementContext con { if (!string.IsNullOrEmpty(result.Value)) { - result.Value = tokenInfo.RegEx.Replace(result.Value, ResolveToken(context, context.Context, tokenInfo.Name)); - - result.Value = result.Value.Replace(@"//", @"/"); - result.Value = result.Value.Replace(@"\\", @"\"); + var replacedValue = tokenInfo.RegEx.Replace(result.Value, ResolveToken(context, context.Context, tokenInfo.Name)); + + if (!string.IsNullOrEmpty(replacedValue)) + { + // everything to '/' + replacedValue = replacedValue.Replace(@"\", @"/"); + + // replace doubles after '://' + var urlParts = replacedValue.Split(new string[] { "://" }, StringSplitOptions.RemoveEmptyEntries); + + // return non 'protocol://' values + if (urlParts.Count() == 1) + { + result.Value = urlParts[0].Replace(@"//", @"/"); + } + else + { + var resultValues = new List(); + + resultValues.Add(urlParts[0]); + + foreach (var value in urlParts.Skip(1)) + { + resultValues.Add(value.Replace(@"//", @"/")); + } + + result.Value = string.Join("://", resultValues.ToArray()); + } + } + else + { + result.Value = replacedValue; + } } } diff --git a/SPMeta2/SPMeta2.Standard/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2.Standard/Properties/AssemblyInfo.cs index 9590ac290..b52d33d8d 100644 --- a/SPMeta2/SPMeta2.Standard/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2.Standard/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.2.17040.0900")] +[assembly: AssemblyFileVersion("1.2.17057.1048")] diff --git a/SPMeta2/SPMeta2/Attributes/Regression/ExpectUpdate.cs b/SPMeta2/SPMeta2/Attributes/Regression/ExpectUpdate.cs index 05870db56..893055e01 100644 --- a/SPMeta2/SPMeta2/Attributes/Regression/ExpectUpdate.cs +++ b/SPMeta2/SPMeta2/Attributes/Regression/ExpectUpdate.cs @@ -1,211 +1,221 @@ -using System; - -namespace SPMeta2.Attributes.Regression -{ - /// - /// Used by regression testing infrastructure to indicate properties which have to be changed with a new provision. - /// - public class ExpectUpdate : Attribute - { - - } - - public class ExpectUpdatAsToolbarType : ExpectUpdate - { - - } - - public class ExpectUpdateAsRichTextMode : ExpectUpdate - { - - } - - public class ExpectUpdateAsChoiceFieldEditFormat : ExpectUpdate - { - - } - - public class ExpectUpdateAsStandalone : ExpectUpdate - { - - } - public class ExpectUpdateAsLCID : ExpectUpdate - { - +using System; + +namespace SPMeta2.Attributes.Regression +{ + /// + /// Used by regression testing infrastructure to indicate properties which have to be changed with a new provision. + /// + public class ExpectUpdate : Attribute + { + + } + + public class ExpectUpdatAsToolbarType : ExpectUpdate + { + + } + + public class ExpectUpdateAsRichTextMode : ExpectUpdate + { + + } + + public class ExpectUpdateAsChoiceFieldEditFormat : ExpectUpdate + { + + } + + public class ExpectUpdateAsStandalone : ExpectUpdate + { + + } + public class ExpectUpdateAsLCID : ExpectUpdate + { + } public class ExpectUpdateDeveloperDashboardSettings : ExpectUpdate { - } - - public class ExpectUpdateAsCamlQuery : ExpectUpdate - { - - } - public class ExpectUpdateAsInternalFieldName : ExpectUpdate - { - - } - public class ExpectUpdateAsUser : ExpectUpdate - { - - } - - public class ExpectUpdateAsBasePermission : ExpectUpdate - { - - } - - public class ExpectUpdateAsUIVersion : ExpectUpdate - { - - } - - public class ExpectUpdateAsWebPartPageLayoutTemplate : ExpectUpdate - { - - } - public class ExpectUpdateAsFileName : ExpectUpdate - { - public string Extension { get; set; } - } - - public class ExpectUpdateAsPageLayoutFileName : ExpectUpdate - { - - } - - public class ExpectUpdateAsPublishingPageContentType : ExpectUpdate - { - - } - - public class ExpectUpdateAsByte : ExpectUpdate - { - - } - - public class ExpectUpdateAsLookupField : ExpectUpdate - { - - } - - public class ExpectUpdateAsChromeState : ExpectUpdate - { - - } - - public class ExpectUpdateAsViewScope : ExpectUpdate - { - - } - - public class ExpectUpdateAsChromeType : ExpectUpdate - { - - } - - public class ExpectUpdateAsBooleanFieldDefaultValue : ExpectUpdate - { - - } - - public class ExpectUpdateAsIntRange : ExpectUpdate - { - public int MinValue { get; set; } - public int MaxValue { get; set; } - } - - public class ExpectUpdateAsUrlFieldFormat : ExpectUpdate - { - } - - public class ExpectUpdateAsUrl : ExpectUpdate - { - public ExpectUpdateAsUrl() - { - Extension = "txt"; - } - - public string Extension { get; set; } - } - - - public class ExpectUpdateAsServerRelativeUrl : ExpectUpdateAsUrl - { - - } - - public class ExpectUpdateAsCalculatedFieldFormula : ExpectUpdate - { - - } - - public class ExpectUpdateAssCalculatedFieldOutputType : ExpectUpdate - { - - } - - public class ExpectUpdateAssCalculatedFieldReferences : ExpectUpdate - { - - } - - - public class ExpectUpdateAsDateTimeFieldCalendarType : ExpectUpdate - { - - } - - public class ExpectUpdateAsDateTimeFieldDisplayFormat : ExpectUpdate - { - - } - - public class ExpectUpdateAsDateTimeFieldFriendlyDisplayFormat : ExpectUpdate - { - - } - - public class ExpectUpdateAsFieldUserSelectionMode : ExpectUpdate - { - - } - - public class ExpectUpdateAsTargetControlType : ExpectUpdate - { - - } - - public class ExpectUpdateAsCompatibleSearchDataTypes : ExpectUpdate - { - - } - - public abstract class ExpectUpdateAsXsltListView : ExpectUpdate - { - - } - - public class ExpectUpdateAsXsltListViewXmlDefinition : ExpectUpdateAsXsltListView - { - - } - - public class ExpectUpdateAsXsltListViewXsl : ExpectUpdateAsXsltListView - { - - } - - public class ExpectUpdateAsXsltListViewXmlLinkUrl : ExpectUpdateAsXsltListView - { - - } - - public class ExpectUpdateAsXsltListViewXslLinkUrl : ExpectUpdateAsXsltListView - { - - } - -} + } + + public class ExpectUpdateAsCamlQuery : ExpectUpdate + { + + } + public class ExpectUpdateAsInternalFieldName : ExpectUpdate + { + + } + public class ExpectUpdateAsUser : ExpectUpdate + { + + } + + public class ExpectUpdateAsBasePermission : ExpectUpdate + { + + } + + public class ExpectUpdateAsUIVersion : ExpectUpdate + { + + } + + public class ExpectUpdateAsWebPartPageLayoutTemplate : ExpectUpdate + { + + } + public class ExpectUpdateAsFileName : ExpectUpdate + { + public string Extension { get; set; } + } + + public class ExpectUpdateAsPageLayoutFileName : ExpectUpdate + { + + } + + public class ExpectUpdateAsPublishingPageContentType : ExpectUpdate + { + + } + + public class ExpectUpdateAsByte : ExpectUpdate + { + + } + + public class ExpectUpdateAsLookupField : ExpectUpdate + { + + } + + public class ExpectUpdateAsChromeState : ExpectUpdate + { + + } + + public class ExpectUpdateAsViewScope : ExpectUpdate + { + + } + + public class ExpectUpdateAsChromeType : ExpectUpdate + { + + } + + public class ExpectUpdateAsBooleanFieldDefaultValue : ExpectUpdate + { + + } + + public class ExpectUpdateAsIntRange : ExpectUpdate + { + public int MinValue { get; set; } + public int MaxValue { get; set; } + } + + public class ExpectUpdateAsNumberFieldDisplayFormat : ExpectUpdate + { + + } + + public class ExpectUpdateAsUrlFieldFormat : ExpectUpdate + { + } + + public class ExpectUpdateAsEmailAddress : ExpectUpdate + { + + } + + public class ExpectUpdateAsUrl : ExpectUpdate + { + public ExpectUpdateAsUrl() + { + Extension = "txt"; + } + + public string Extension { get; set; } + } + + + public class ExpectUpdateAsServerRelativeUrl : ExpectUpdateAsUrl + { + + } + + public class ExpectUpdateAsCalculatedFieldFormula : ExpectUpdate + { + + } + + public class ExpectUpdateAssCalculatedFieldOutputType : ExpectUpdate + { + + } + + public class ExpectUpdateAssCalculatedFieldReferences : ExpectUpdate + { + + } + + + public class ExpectUpdateAsDateTimeFieldCalendarType : ExpectUpdate + { + + } + + public class ExpectUpdateAsDateTimeFieldDisplayFormat : ExpectUpdate + { + + } + + public class ExpectUpdateAsDateTimeFieldFriendlyDisplayFormat : ExpectUpdate + { + + } + + public class ExpectUpdateAsFieldUserSelectionMode : ExpectUpdate + { + + } + + public class ExpectUpdateAsTargetControlType : ExpectUpdate + { + + } + + public class ExpectUpdateAsCompatibleSearchDataTypes : ExpectUpdate + { + + } + + public abstract class ExpectUpdateAsXsltListView : ExpectUpdate + { + + } + + public class ExpectUpdateAsXsltListViewXmlDefinition : ExpectUpdateAsXsltListView + { + + } + + public class ExpectUpdateAsXsltListViewXsl : ExpectUpdateAsXsltListView + { + + } + + public class ExpectUpdateAsXsltListViewXmlLinkUrl : ExpectUpdateAsXsltListView + { + + } + + public class ExpectUpdateAsXsltListViewXslLinkUrl : ExpectUpdateAsXsltListView + { + + } + +} diff --git a/SPMeta2/SPMeta2/Definitions/Fields/NumberFieldDefinition.cs b/SPMeta2/SPMeta2/Definitions/Fields/NumberFieldDefinition.cs index 06ef93591..b5cb3bf0a 100644 --- a/SPMeta2/SPMeta2/Definitions/Fields/NumberFieldDefinition.cs +++ b/SPMeta2/SPMeta2/Definitions/Fields/NumberFieldDefinition.cs @@ -1,89 +1,94 @@ -using System; -using System.Runtime.Serialization; -using SPMeta2.Attributes; -using SPMeta2.Attributes.Regression; -using SPMeta2.Enumerations; -using SPMeta2.Utils; - -namespace SPMeta2.Definitions.Fields -{ - /// - /// Allows to define and deploy number field. - /// - /// - [SPObjectType(SPObjectModelType.SSOM, "Microsoft.SharePoint.SPFieldNumber", "Microsoft.SharePoint")] - [SPObjectType(SPObjectModelType.CSOM, "Microsoft.SharePoint.Client.FieldNumber", "Microsoft.SharePoint.Client")] - - [DefaultParentHost(typeof(SiteDefinition))] - [DefaultRootHost(typeof(SiteDefinition))] - - [Serializable] - [DataContract] - [ExpectArrayExtensionMethod] - [ExpectManyInstances] - - public class NumberFieldDefinition : FieldDefinition - { - #region constructors - - public NumberFieldDefinition() - { - DisplayFormat = BuiltInNumberFormatTypes.Automatic; - } - - #endregion - - #region properties - - - [ExpectValidation] - [ExpectRequired] - [DataMember] - public override string FieldType - { - get - { - return BuiltInFieldTypes.Number; - } - set - { - - } - } - - [ExpectValidation] - [DataMember] - [ExpectNullable] - public string DisplayFormat { get; set; } - - [ExpectValidation] - [ExpectUpdateAsIntRange(MinValue = 1000, MaxValue = 5000)] - [DataMember] - public double? MaximumValue { get; set; } - - [ExpectValidation] - [ExpectUpdateAsIntRange(MinValue = 100, MaxValue = 500)] - [DataMember] - public double? MinimumValue { get; set; } - - [ExpectValidation] - //[ExpectUpdate], only SSOM - [DataMember] - public bool ShowAsPercentage { get; set; } - - #endregion - - #region methods - - public override string ToString() - { - return new ToStringResult(this, base.ToString()) - .AddPropertyValue(d => d.MaximumValue) - .AddPropertyValue(d => d.MinimumValue) - .AddPropertyValue(d => d.ShowAsPercentage) - .ToString(); - } - - #endregion - } -} +using System; +using System.Runtime.Serialization; +using SPMeta2.Attributes; +using SPMeta2.Attributes.Regression; +using SPMeta2.Enumerations; +using SPMeta2.Utils; + +namespace SPMeta2.Definitions.Fields +{ + /// + /// Allows to define and deploy number field. + /// + /// + [SPObjectType(SPObjectModelType.SSOM, "Microsoft.SharePoint.SPFieldNumber", "Microsoft.SharePoint")] + [SPObjectType(SPObjectModelType.CSOM, "Microsoft.SharePoint.Client.FieldNumber", "Microsoft.SharePoint.Client")] + + [DefaultParentHost(typeof(SiteDefinition))] + [DefaultRootHost(typeof(SiteDefinition))] + + [Serializable] + [DataContract] + [ExpectArrayExtensionMethod] + [ExpectManyInstances] + + public class NumberFieldDefinition : FieldDefinition + { + #region constructors + + public NumberFieldDefinition() + { + DisplayFormat = BuiltInNumberFormatTypes.Automatic; + } + + #endregion + + #region properties + + + [ExpectValidation] + [ExpectRequired] + [DataMember] + public override string FieldType + { + get + { + return BuiltInFieldTypes.Number; + } + set + { + + } + } + + /// + /// Can be updated in SSOM. + /// CSOM API does not support changes/updates. + /// + [ExpectValidation] + [DataMember] + [ExpectNullable] + [ExpectUpdateAsNumberFieldDisplayFormat()] + public string DisplayFormat { get; set; } + + [ExpectValidation] + [ExpectUpdateAsIntRange(MinValue = 1000, MaxValue = 5000)] + [DataMember] + public double? MaximumValue { get; set; } + + [ExpectValidation] + [ExpectUpdateAsIntRange(MinValue = 100, MaxValue = 500)] + [DataMember] + public double? MinimumValue { get; set; } + + [ExpectValidation] + //[ExpectUpdate], only SSOM + [DataMember] + public bool ShowAsPercentage { get; set; } + + #endregion + + #region methods + + public override string ToString() + { + return new ToStringResult(this, base.ToString()) + .AddPropertyValue(d => d.MaximumValue) + .AddPropertyValue(d => d.MinimumValue) + .AddPropertyValue(d => d.ShowAsPercentage) + .ToString(); + } + + #endregion + } +} diff --git a/SPMeta2/SPMeta2/Definitions/ListViewDefinition.cs b/SPMeta2/SPMeta2/Definitions/ListViewDefinition.cs index d3430b821..624ef8d29 100644 --- a/SPMeta2/SPMeta2/Definitions/ListViewDefinition.cs +++ b/SPMeta2/SPMeta2/Definitions/ListViewDefinition.cs @@ -53,6 +53,8 @@ public ListViewDefinition() InlineEdit = null; TabularView = null; + + Types = new Collection(); } #endregion @@ -214,6 +216,16 @@ public ListViewDefinition() [DataMember] public string Type { get; set; } + /// + /// If set, used insted of .Type property. + /// Allows to define multiple types of view, such as 'ViewType.Calendar | ViewType.Recurrence' + /// + [ExpectValidation] + //[ExpectRequired] + [DataMember] + + public Collection Types { get; set; } + /// /// Gets or sets field references for one or more aggregate, or total, columns used in a view. /// diff --git a/SPMeta2/SPMeta2/Definitions/WebDefinition.cs b/SPMeta2/SPMeta2/Definitions/WebDefinition.cs index c2e2e7b6c..5d3325cc4 100644 --- a/SPMeta2/SPMeta2/Definitions/WebDefinition.cs +++ b/SPMeta2/SPMeta2/Definitions/WebDefinition.cs @@ -154,13 +154,13 @@ public WebDefinition() [DataMember] [ExpectValidation] - //[ExpectUpdateAsUrl(Extension = ".png")] + [ExpectUpdateAsUrl(Extension = ".png")] [ExpectNullable] public string SiteLogoUrl { get; set; } [DataMember] [ExpectValidation] - //[ExpectUpdateAsUrl(Extension = ".css")] + [ExpectUpdateAsUrl(Extension = ".css")] [ExpectNullable] public string AlternateCssUrl { get; set; } @@ -173,10 +173,13 @@ public WebDefinition() [DataMember] [ExpectNullable] + [ExpectValidation] + // [ExpectUpdateAsEmailAddress] public string RequestAccessEmail { get; set; } [DataMember] [ExpectNullable] + [ExpectValidation] public bool? MembersCanShare { get; set; } #endregion diff --git a/SPMeta2/SPMeta2/Enumerations/BuiltInContentTypeId.cs b/SPMeta2/SPMeta2/Enumerations/BuiltInContentTypeId.cs index 8f06d5864..30e4e2ecf 100644 --- a/SPMeta2/SPMeta2/Enumerations/BuiltInContentTypeId.cs +++ b/SPMeta2/SPMeta2/Enumerations/BuiltInContentTypeId.cs @@ -1,66 +1,76 @@ // ReSharper disable InconsistentNaming + +using System; + namespace SPMeta2.Enumerations -{ - /// - /// Content type names generated on top of Microsoft.SharePoint.SPBuiltInContentTypeId class. - /// - public static class BuiltInContentTypeNames - { - public static readonly string AdminTask = "Administrative Task"; - public static readonly string Announcement = "Announcement"; - public static readonly string BasicPage = "Basic Page"; - public static readonly string BlogComment = "Comment"; - public static readonly string BlogPost = "Post"; - public static readonly string CallTracking = "Phone Call Memo"; - public static readonly string Contact = "Contact"; - public static readonly string Discussion = "Discussion"; - public static readonly string DisplayTemplateJS = "JavaScript Display Template"; - public static readonly string Document = "Document"; - public static readonly string DocumentSet = "Document Collection Folder"; - public static readonly string DocumentSet_Correct = "Document Set"; - public static readonly string DocumentWorkflowItem = "User Workflow Document"; - public static readonly string DomainGroup = "DomainGroup"; - public static readonly string DublinCoreName = "Dublin Core Columns"; - public static readonly string Event = "Event"; - public static readonly string FarEastContact = "East Asia Contact"; - public static readonly string Folder = "Folder"; - public static readonly string GbwCirculationCTName = "Circulation"; - public static readonly string GbwOfficialNoticeCTName = "Official Notice"; - public static readonly string HealthReport = "Health Analyzer Report"; - public static readonly string HealthRuleDefinition = "Health Analyzer Rule Definition"; - public static readonly string Holiday = "Holiday"; - public static readonly string IMEDictionaryItem = "New Word"; - public static readonly string Issue = "Issue"; - public static readonly string Item = "Item"; - public static readonly string Link = "Link"; - public static readonly string LinkToDocument = "Link to a Document"; - public static readonly string MasterPage = "Master Page"; - public static readonly string MasterPagePreview = "Master Page Preview"; - public static readonly string Message = "Message"; - public static readonly string ODCDocument = "Office Data Connection File"; - public static readonly string Person = "Person"; - public static readonly string Picture = "Picture"; - public static readonly string Resource = "Resource"; - public static readonly string ResourceGroup = "Resource Group"; - public static readonly string ResourceReservation = "Reservations"; - public static readonly string RootOfList = "RootOfList"; - public static readonly string Schedule = "Schedule"; - public static readonly string ScheduleAndResourceReservation = "Schedule and Reservations"; - public static readonly string SharePointGroup = "SharePointGroup"; - public static readonly string SummaryTask = "Summary Task"; - public static readonly string System = "System"; - public static readonly string Task = "Task"; - public static readonly string Timecard = "Timecard"; - public static readonly string UDCDocument = "Universal Data Connection File"; - public static readonly string UntypedDocument = "Unknown Document Type"; - public static readonly string WebPartPage = "Web Part Page"; - public static readonly string WhatsNew = "What's New Notification"; - public static readonly string Whereabouts = "Users"; - public static readonly string WikiDocument = "Wiki Page"; - public static readonly string WorkflowHistory = "Workflow History"; - public static readonly string WorkflowTask = "Workflow Task"; - public static readonly string WorkflowTaskSharePoint2013 = "Workflow Task (SharePoint 2013)"; - public static readonly string XMLDocument = "Form"; - public static readonly string XSLStyle = "List View Style"; +{ + /// + /// Content type IDs generated on top of Microsoft.SharePoint.SPBuiltInContentTypeId class. + /// + public static class BuiltInContentTypeId + { + public static readonly string AdminTask = "0x010802"; + public static readonly string Announcement = "0x0104"; + public static readonly string BasicPage = "0x010109"; + public static readonly string BlogComment = "0x0111"; + public static readonly string BlogPost = "0x0110"; + public static readonly string CallTracking = "0x0100807FBAC5EB8A4653B8D24775195B5463"; + public static readonly string Contact = "0x0106"; + public static readonly string Discussion = "0x012002"; + public static readonly string DisplayTemplateJS = "0x0101002039C03B61C64EC4A04F5361F3851068"; + public static readonly string Document = "0x0101"; + + [Obsolete("Correct 'Document Set' content type ID is '0x0120D520. Please use DocumentSet_Correct property instead. More details - https://github.com/SubPointSolutions/spmeta2/issues/157'")] + public static readonly string DocumentSet = "0x0120D5"; + public static readonly string DocumentSet_Correct = "0x0120D520"; + + public static readonly string DocumentWorkflowItem = "0x010107"; + public static readonly string DomainGroup = "0x010C"; + public static readonly string DublinCoreName = "0x01010B"; + public static readonly string Event = "0x0102"; + public static readonly string FarEastContact = "0x0116"; + public static readonly string Folder = "0x0120"; + public static readonly string GbwCirculationCTName = "0x01000F389E14C9CE4CE486270B9D4713A5D6"; + public static readonly string GbwOfficialNoticeCTName = "0x01007CE30DD1206047728BAFD1C39A850120"; + public static readonly string HealthReport = "0x0100F95DB3A97E8046B58C6A54FB31F2BD46"; + public static readonly string HealthRuleDefinition = "0x01003A8AA7A4F53046158C5ABD98036A01D5"; + public static readonly string Holiday = "0x01009BE2AB5291BF4C1A986910BD278E4F18"; + public static readonly string IMEDictionaryItem = "0x010018F21907ED4E401CB4F14422ABC65304"; + public static readonly string Issue = "0x0103"; + public static readonly string Item = "0x01"; + public static readonly string Link = "0x0105"; + public static readonly string LinkToDocument = "0x01010A"; + public static readonly string MasterPage = "0x010105"; + public static readonly string MasterPagePreview = "0x010106"; + public static readonly string Message = "0x0107"; + public static readonly string ODCDocument = "0x010100629D00608F814DD6AC8A86903AEE72AA"; + public static readonly string Person = "0x010A"; + public static readonly string Picture = "0x010102"; + public static readonly string Resource = "0x01004C9F4486FBF54864A7B0A33D02AD19B1"; + public static readonly string ResourceGroup = "0x0100CA13F2F8D61541B180952DFB25E3E8E4"; + public static readonly string ResourceReservation = "0x0102004F51EFDEA49C49668EF9C6744C8CF87D"; + public static readonly string RootOfList = "0x012001"; + public static readonly string Schedule = "0x0102007DBDC1392EAF4EBBBF99E41D8922B264"; + public static readonly string ScheduleAndResourceReservation = "0x01020072BB2A38F0DB49C3A96CF4FA85529956"; + public static readonly string SharePointGroup = "0x010B"; + public static readonly string SummaryTask = "0x012004"; + public static readonly string System = "0x"; + public static readonly string Task = "0x0108"; + public static readonly string Timecard = "0x0100C30DDA8EDB2E434EA22D793D9EE42058"; + public static readonly string UDCDocument = "0x010100B4CBD48E029A4AD8B62CB0E41868F2B0"; + public static readonly string UntypedDocument = "0x010104"; + public static readonly string WebPartPage = "0x01010901"; + public static readonly string WhatsNew = "0x0100A2CA87FF01B442AD93F37CD7DD0943EB"; + public static readonly string Whereabouts = "0x0100FBEEE6F0C500489B99CDA6BB16C398F7"; + public static readonly string WikiDocument = "0x010108"; + public static readonly string WorkflowHistory = "0x0109"; + public static readonly string WorkflowTask = "0x010801"; + + public static readonly string WorkflowTaskSharePoint2013 = "0x0108003365C4474CAE8C42BCE396314E88E51F"; + + public static readonly string XMLDocument = "0x010101"; + public static readonly string XSLStyle = "0x010100734778F2B7DF462491FC91844AE431CF"; + + public static readonly string ComposedLook = "0x00EBB0D5D32C733345B0AA3C79625DD501"; } } diff --git a/SPMeta2/SPMeta2/Enumerations/BuiltInContentTypeNames.cs b/SPMeta2/SPMeta2/Enumerations/BuiltInContentTypeNames.cs index c8e519268..eedac6dfb 100644 --- a/SPMeta2/SPMeta2/Enumerations/BuiltInContentTypeNames.cs +++ b/SPMeta2/SPMeta2/Enumerations/BuiltInContentTypeNames.cs @@ -2,74 +2,67 @@ // ReSharper disable InconsistentNaming namespace SPMeta2.Enumerations -{ - /// - /// Content type IDs generated on top of Microsoft.SharePoint.SPBuiltInContentTypeId class. - /// - public static class BuiltInContentTypeId - { - public static readonly string AdminTask = "0x010802"; - public static readonly string Announcement = "0x0104"; - public static readonly string BasicPage = "0x010109"; - public static readonly string BlogComment = "0x0111"; - public static readonly string BlogPost = "0x0110"; - public static readonly string CallTracking = "0x0100807FBAC5EB8A4653B8D24775195B5463"; - public static readonly string Contact = "0x0106"; - public static readonly string Discussion = "0x012002"; - public static readonly string DisplayTemplateJS = "0x0101002039C03B61C64EC4A04F5361F3851068"; - public static readonly string Document = "0x0101"; - - [Obsolete("Correct 'Document Set' content type ID is '0x0120D520. Please use DocumentSet_Correct property instead. More details - https://github.com/SubPointSolutions/spmeta2/issues/157'")] - public static readonly string DocumentSet = "0x0120D5"; - public static readonly string DocumentSet_Correct = "0x0120D520"; - - public static readonly string DocumentWorkflowItem = "0x010107"; - public static readonly string DomainGroup = "0x010C"; - public static readonly string DublinCoreName = "0x01010B"; - public static readonly string Event = "0x0102"; - public static readonly string FarEastContact = "0x0116"; - public static readonly string Folder = "0x0120"; - public static readonly string GbwCirculationCTName = "0x01000F389E14C9CE4CE486270B9D4713A5D6"; - public static readonly string GbwOfficialNoticeCTName = "0x01007CE30DD1206047728BAFD1C39A850120"; - public static readonly string HealthReport = "0x0100F95DB3A97E8046B58C6A54FB31F2BD46"; - public static readonly string HealthRuleDefinition = "0x01003A8AA7A4F53046158C5ABD98036A01D5"; - public static readonly string Holiday = "0x01009BE2AB5291BF4C1A986910BD278E4F18"; - public static readonly string IMEDictionaryItem = "0x010018F21907ED4E401CB4F14422ABC65304"; - public static readonly string Issue = "0x0103"; - public static readonly string Item = "0x01"; - public static readonly string Link = "0x0105"; - public static readonly string LinkToDocument = "0x01010A"; - public static readonly string MasterPage = "0x010105"; - public static readonly string MasterPagePreview = "0x010106"; - public static readonly string Message = "0x0107"; - public static readonly string ODCDocument = "0x010100629D00608F814DD6AC8A86903AEE72AA"; - public static readonly string Person = "0x010A"; - public static readonly string Picture = "0x010102"; - public static readonly string Resource = "0x01004C9F4486FBF54864A7B0A33D02AD19B1"; - public static readonly string ResourceGroup = "0x0100CA13F2F8D61541B180952DFB25E3E8E4"; - public static readonly string ResourceReservation = "0x0102004F51EFDEA49C49668EF9C6744C8CF87D"; - public static readonly string RootOfList = "0x012001"; - public static readonly string Schedule = "0x0102007DBDC1392EAF4EBBBF99E41D8922B264"; - public static readonly string ScheduleAndResourceReservation = "0x01020072BB2A38F0DB49C3A96CF4FA85529956"; - public static readonly string SharePointGroup = "0x010B"; - public static readonly string SummaryTask = "0x012004"; - public static readonly string System = "0x"; - public static readonly string Task = "0x0108"; - public static readonly string Timecard = "0x0100C30DDA8EDB2E434EA22D793D9EE42058"; - public static readonly string UDCDocument = "0x010100B4CBD48E029A4AD8B62CB0E41868F2B0"; - public static readonly string UntypedDocument = "0x010104"; - public static readonly string WebPartPage = "0x01010901"; - public static readonly string WhatsNew = "0x0100A2CA87FF01B442AD93F37CD7DD0943EB"; - public static readonly string Whereabouts = "0x0100FBEEE6F0C500489B99CDA6BB16C398F7"; - public static readonly string WikiDocument = "0x010108"; - public static readonly string WorkflowHistory = "0x0109"; - public static readonly string WorkflowTask = "0x010801"; - - public static readonly string WorkflowTaskSharePoint2013 = "0x0108003365C4474CAE8C42BCE396314E88E51F"; - - public static readonly string XMLDocument = "0x010101"; - public static readonly string XSLStyle = "0x010100734778F2B7DF462491FC91844AE431CF"; - - public static readonly string ComposedLook = "0x00EBB0D5D32C733345B0AA3C79625DD501"; +{ + /// + /// Content type names generated on top of Microsoft.SharePoint.SPBuiltInContentTypeId class. + /// + public static class BuiltInContentTypeNames + { + public static readonly string AdminTask = "Administrative Task"; + public static readonly string Announcement = "Announcement"; + public static readonly string BasicPage = "Basic Page"; + public static readonly string BlogComment = "Comment"; + public static readonly string BlogPost = "Post"; + public static readonly string CallTracking = "Phone Call Memo"; + public static readonly string Contact = "Contact"; + public static readonly string Discussion = "Discussion"; + public static readonly string DisplayTemplateJS = "JavaScript Display Template"; + public static readonly string Document = "Document"; + public static readonly string DocumentSet = "Document Collection Folder"; + public static readonly string DocumentSet_Correct = "Document Set"; + public static readonly string DocumentWorkflowItem = "User Workflow Document"; + public static readonly string DomainGroup = "DomainGroup"; + public static readonly string DublinCoreName = "Dublin Core Columns"; + public static readonly string Event = "Event"; + public static readonly string FarEastContact = "East Asia Contact"; + public static readonly string Folder = "Folder"; + public static readonly string GbwCirculationCTName = "Circulation"; + public static readonly string GbwOfficialNoticeCTName = "Official Notice"; + public static readonly string HealthReport = "Health Analyzer Report"; + public static readonly string HealthRuleDefinition = "Health Analyzer Rule Definition"; + public static readonly string Holiday = "Holiday"; + public static readonly string IMEDictionaryItem = "New Word"; + public static readonly string Issue = "Issue"; + public static readonly string Item = "Item"; + public static readonly string Link = "Link"; + public static readonly string LinkToDocument = "Link to a Document"; + public static readonly string MasterPage = "Master Page"; + public static readonly string MasterPagePreview = "Master Page Preview"; + public static readonly string Message = "Message"; + public static readonly string ODCDocument = "Office Data Connection File"; + public static readonly string Person = "Person"; + public static readonly string Picture = "Picture"; + public static readonly string Resource = "Resource"; + public static readonly string ResourceGroup = "Resource Group"; + public static readonly string ResourceReservation = "Reservations"; + public static readonly string RootOfList = "RootOfList"; + public static readonly string Schedule = "Schedule"; + public static readonly string ScheduleAndResourceReservation = "Schedule and Reservations"; + public static readonly string SharePointGroup = "SharePointGroup"; + public static readonly string SummaryTask = "Summary Task"; + public static readonly string System = "System"; + public static readonly string Task = "Task"; + public static readonly string Timecard = "Timecard"; + public static readonly string UDCDocument = "Universal Data Connection File"; + public static readonly string UntypedDocument = "Unknown Document Type"; + public static readonly string WebPartPage = "Web Part Page"; + public static readonly string WhatsNew = "What's New Notification"; + public static readonly string Whereabouts = "Users"; + public static readonly string WikiDocument = "Wiki Page"; + public static readonly string WorkflowHistory = "Workflow History"; + public static readonly string WorkflowTask = "Workflow Task"; + public static readonly string WorkflowTaskSharePoint2013 = "Workflow Task (SharePoint 2013)"; + public static readonly string XMLDocument = "Form"; + public static readonly string XSLStyle = "List View Style"; } } diff --git a/SPMeta2/SPMeta2/Properties/AssemblyInfo.cs b/SPMeta2/SPMeta2/Properties/AssemblyInfo.cs index 7d044885f..0dbad9ede 100644 --- a/SPMeta2/SPMeta2/Properties/AssemblyInfo.cs +++ b/SPMeta2/SPMeta2/Properties/AssemblyInfo.cs @@ -32,4 +32,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.2.17040.0900")] +[assembly: AssemblyFileVersion("1.2.17057.1048")] diff --git a/SPMeta2/SPMeta2/ServiceContainer.cs b/SPMeta2/SPMeta2/ServiceContainer.cs index 206860e77..3392d6944 100644 --- a/SPMeta2/SPMeta2/ServiceContainer.cs +++ b/SPMeta2/SPMeta2/ServiceContainer.cs @@ -70,6 +70,17 @@ public void RegisterService(Type type, object service) list.Add(service); } + public void ReplaceService(Type type, object service) + { + if (!Services.ContainsKey(type)) + Services.Add(type, new List()); + + var list = Services[type]; + + list.Clear(); + list.Add(service); + } + public void RegisterServices(Type type, List services) { foreach (var s in services) diff --git a/SPMeta2/SPMeta2/Syntax/Default/RootWebDefinitionSyntax.cs b/SPMeta2/SPMeta2/Syntax/Default/RootWebDefinitionSyntax.cs index 85fa70d01..f84a8e6db 100644 --- a/SPMeta2/SPMeta2/Syntax/Default/RootWebDefinitionSyntax.cs +++ b/SPMeta2/SPMeta2/Syntax/Default/RootWebDefinitionSyntax.cs @@ -8,7 +8,27 @@ namespace SPMeta2.Syntax.Default [Serializable] [DataContract] public class RootWebModelNode : TypedModelNode, - IWebModelNode, IWebHostModelNode + // should always replicate WebModelNode syntax + // Missing TopNavigationNodeDefinition Syntax for RootWebModelNode #953 + // https://github.com/SubPointSolutions/spmeta2/issues/953 + + IWebModelNode, + IFieldHostModelNode, + IContentTypeHostModelNode, + ISecurableObjectHostModelNode, + IPropertyHostModelNode, + IEventReceiverHostModelNode, + IWebHostModelNode, + IWelcomePageHostModelNode, + IModuleFileHostModelNode, + IAuditSettingsHostModelNode, + IFeatureHostModelNode, + IUserCustomActionHostModelNode, + ITopNavigationNodeHostModelNode, + IQuickLaunchNavigationNodeHostModelNode, + ISP2013WorkflowSubscriptionHostModelNode, + IWorkflowAssociationHostModelNode, + ISearchSettingsHostModelNode { } diff --git a/SPMeta2/SPMeta2/Syntax/Default/SPMeta2Model.cs b/SPMeta2/SPMeta2/Syntax/Default/SPMeta2Model.cs index 7c9d0f25d..5a45a320e 100644 --- a/SPMeta2/SPMeta2/Syntax/Default/SPMeta2Model.cs +++ b/SPMeta2/SPMeta2/Syntax/Default/SPMeta2Model.cs @@ -46,7 +46,7 @@ public static FarmModelNode NewFarmModel() /// /// /// - public static ModelNode NewFarmModel(Action action) + public static FarmModelNode NewFarmModel(Action action) { var node = NewFarmModel(new FarmDefinition(), action); diff --git a/SPMeta2/SPMeta2/Syntax/Default/WebDefinitionSyntax.cs b/SPMeta2/SPMeta2/Syntax/Default/WebDefinitionSyntax.cs index 9c5213781..d491ff645 100644 --- a/SPMeta2/SPMeta2/Syntax/Default/WebDefinitionSyntax.cs +++ b/SPMeta2/SPMeta2/Syntax/Default/WebDefinitionSyntax.cs @@ -8,7 +8,12 @@ namespace SPMeta2.Syntax.Default { [Serializable] [DataContract] - public class WebModelNode : TypedModelNode, IWebModelNode, + public class WebModelNode : TypedModelNode, + // should always be same as RootWebModelNode + // Missing TopNavigationNodeDefinition Syntax for RootWebModelNode #953 + // https://github.com/SubPointSolutions/spmeta2/issues/953 + + IWebModelNode, IFieldHostModelNode, IContentTypeHostModelNode, ISecurableObjectHostModelNode, diff --git a/appveyor-v12.yml b/appveyor-v12.yml new file mode 100644 index 000000000..deba6cd3e --- /dev/null +++ b/appveyor-v12.yml @@ -0,0 +1,25 @@ +environment: + SPMeta2_DefaultTestUserLogins: + secure: 3HnXxy6w2UfBFP55pJ6q1/TguITu3p3mmEo+7U2dm1g= + +test: + assemblies: + - '**\*.Tests.dll' + categories: + only: + - CI.Core + +clone_folder: c:\prj\m2 + +before_build: + - ps: c:\prj\m2\SPMeta2\Build\build.ps1 -Verbosity Minimal -Target "Default-Appveyor" + - ps: c:\prj\m2\SPMeta2\Build\build-new.ps1 -Verbosity Minimal -Target "Default-CI" + +build_script: + - ps: c:\prj\m2\SPMeta2\SPMeta2.Build\build.v12.ps1 + +after_test: + - ps: c:\prj\m2\SPMeta2\SPMeta2.Build\nuget.v12.ps1 + +artifacts: + - path: '**\*.nupkg' \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index cc36d0959..c072f3bed 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,26 +1,9 @@ -environment: - SPMeta2_DefaultTestUserLogins: - secure: 3HnXxy6w2UfBFP55pJ6q1/TguITu3p3mmEo+7U2dm1g= - -# expecting base tests passed under 'CI.Core' category -# everything under .NET (non-SharePoint tests) must be marked as 'CI.Core' -test: - assemblies: - - '**\*.Tests.dll' - categories: - only: - - CI.Core +test: off clone_folder: c:\prj\m2 -before_build: - - ps: c:\prj\m2\SPMeta2\Build\build.ps1 -Verbosity Minimal -Target "Default-Appveyor" - build_script: - - ps: c:\prj\m2\SPMeta2\SPMeta2.Build\build.v12.ps1 - -after_test: - - ps: c:\prj\m2\SPMeta2\SPMeta2.Build\nuget.v12.ps1 + - ps: c:\prj\m2\SPMeta2\Build\build.ps1 -Verbosity Minimal -Target "Default-CI" artifacts: - path: '**\*.nupkg' \ No newline at end of file
{0}{0}