├── .gitignore
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── Documentation
└── Readme.txt
├── LICENSE
├── README.md
├── RelativityDev.RelativityTestHelpers.nuspec
├── Source
└── Relativity.Test.Helpers
│ ├── Relativity.Test.Helpers.Example.NUnit
│ ├── LICENSE.txt
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Relativity.Test.Helpers.Example.NUnit.csproj
│ ├── TestHelpers_Kepler_App.rap
│ ├── TestTemplate.cs
│ ├── app.config
│ ├── oi
│ │ └── unmanaged
│ │ │ ├── cmmap000.bin
│ │ │ ├── oilink.exe
│ │ │ ├── oilink.jar
│ │ │ ├── sccca-R1.dll
│ │ │ ├── sccch-R1.dll
│ │ │ ├── sccda-R1.dll
│ │ │ ├── sccex-R1.dll
│ │ │ ├── sccfa-R1.dll
│ │ │ ├── sccfi-R1.dll
│ │ │ ├── sccfmt-R1.dll
│ │ │ ├── sccfnt-R1.dll
│ │ │ ├── sccfut-R1.dll
│ │ │ ├── sccind-R1.dll
│ │ │ ├── scclo-R1.dll
│ │ │ ├── sccut-R1.dll
│ │ │ └── wvcore-R1.dll
│ └── packages.config
│ ├── Relativity.Test.Helpers.NUnit.Integration
│ ├── ArtifactHelpers
│ │ ├── ClientHelperIntegrationTests.cs
│ │ ├── DocumentHelperIntegrationTests.cs
│ │ ├── FieldsHelperIntegrationTests.cs
│ │ └── FoldersHelperIntegrationTests.cs
│ ├── Files
│ │ └── FakeApp.rap
│ ├── GroupHelpers
│ │ └── GroupHelpersIntegrationTests.cs
│ ├── Kepler
│ │ ├── ApplicationInstallHelperTests.cs
│ │ └── OAuth2HelperTests.cs
│ ├── Mail
│ │ ├── GmailMailHelperTests.cs
│ │ └── MailTrapMailHelperTests.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Relativity.Test.Helpers.NUnit.Integration.csproj
│ ├── RetryHelper
│ │ └── RetryLogicHelperTests.cs
│ ├── TestConstants.cs
│ ├── TestEHHelperIntegrationTests.cs
│ ├── TestHelperIntegrationTests.cs
│ ├── TestHelperRunSettingsIntegrationTests.cs
│ ├── TestHelpers_Kepler_App.rap
│ ├── TestImportApiHelper.cs
│ ├── UserHelpers
│ │ └── UserHelpersIntegrationTests.cs
│ ├── WorkspaceHelpers
│ │ ├── CreateWorkspaceHelperTests.cs
│ │ ├── DeleteWorkspaceHelperTests.cs
│ │ └── GetWorkspaceHelperTests.cs
│ ├── app.config
│ ├── oi
│ │ └── unmanaged
│ │ │ ├── cmmap000.bin
│ │ │ ├── oilink.exe
│ │ │ ├── oilink.jar
│ │ │ ├── sccca-R1.dll
│ │ │ ├── sccch-R1.dll
│ │ │ ├── sccda-R1.dll
│ │ │ ├── sccex-R1.dll
│ │ │ ├── sccfa-R1.dll
│ │ │ ├── sccfi-R1.dll
│ │ │ ├── sccfmt-R1.dll
│ │ │ ├── sccfnt-R1.dll
│ │ │ ├── sccfut-R1.dll
│ │ │ ├── sccind-R1.dll
│ │ │ ├── scclo-R1.dll
│ │ │ ├── sccut-R1.dll
│ │ │ └── wvcore-R1.dll
│ ├── packages.config
│ └── test.runsettings
│ ├── Relativity.Test.Helpers.sln
│ ├── Relativity.Test.Helpers.sln.DotSettings
│ ├── Relativity.Test.Helpers
│ ├── ArtifactHelpers
│ │ ├── ChoiceHelper.cs
│ │ ├── ClientHelper.cs
│ │ ├── DocumentHelper.cs
│ │ ├── FieldHelper.cs
│ │ ├── FoldersHelper.cs
│ │ └── Interfaces
│ │ │ ├── IDocumentHelper.cs
│ │ │ ├── IFieldsHelper.cs
│ │ │ └── IFoldersHelper.cs
│ ├── Authentication
│ │ ├── AuthenticationManager.cs
│ │ ├── AuthenticationProvider.cs
│ │ └── UserInfo.cs
│ ├── Constants.cs
│ ├── EnvironmentContext.cs
│ ├── Exceptions
│ │ ├── IntegrationTestException.cs
│ │ ├── TestHelpersApplicationInstallException.cs
│ │ ├── TestHelpersException.cs
│ │ └── TestHelpersOAuth2Exception.cs
│ ├── FreeImage.dll
│ ├── GroupHelpers
│ │ └── GroupHelper.cs
│ ├── HelperClass
│ │ ├── TestAgentHelper.cs
│ │ └── TestEHHelper.cs
│ ├── ImportAPIHelper
│ │ ├── Constants.cs
│ │ ├── ImportAPIHelper.cs
│ │ ├── ImportDocument.cs
│ │ └── Request
│ │ │ └── ImportJobRequest.cs
│ ├── Kepler
│ │ ├── ApplicationInstallHelper.cs
│ │ ├── IApplicationInstallHelper.cs
│ │ ├── IOAuth2Helper.cs
│ │ └── OAuth2Helper.cs
│ ├── LICENSE.txt
│ ├── Logging
│ │ ├── ConsoleLogger.cs
│ │ └── TestLogFactory.cs
│ ├── Mail
│ │ ├── GmailInboxModel.cs
│ │ ├── GmailMailHelper.cs
│ │ ├── GmailMessageModel.cs
│ │ ├── IMailHelper.cs
│ │ ├── IMailInboxModel.cs
│ │ ├── IMailMessageModel.cs
│ │ ├── MailRepository.cs
│ │ ├── MailTrapInboxModel.cs
│ │ ├── MailTrapMailHelper.cs
│ │ └── MailTrapMessageModel.cs
│ ├── MyOwnContext.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Relativity.Test.Helpers.csproj
│ ├── Relativity.Test.Helpers.csproj.DotSettings
│ ├── RetryHelper
│ │ ├── IRetryLogicHelper.cs
│ │ ├── RetryHelper.cs
│ │ └── RetryLogicHelper.cs
│ ├── ServiceFactory
│ │ ├── Extentions
│ │ │ └── ServiceManagerExtension.cs
│ │ ├── ServiceManagerExtension.cs
│ │ ├── ServicesManager.cs
│ │ └── URLHelper.cs
│ ├── SharedTestHelpers
│ │ ├── AppConfigSettings.cs
│ │ ├── ConfigurationHelpers.cs
│ │ └── ConfigurationSettings.cs
│ ├── TestHelper.cs
│ ├── UserHelpers
│ │ ├── UserHelper.cs
│ │ └── create.cs
│ ├── WorkspaceHelpers
│ │ └── WorkspaceHelpers.cs
│ ├── app.config
│ ├── oi
│ │ └── unmanaged
│ │ │ ├── cmmap000.bin
│ │ │ ├── oilink.exe
│ │ │ ├── oilink.jar
│ │ │ ├── sccca-R1.dll
│ │ │ ├── sccch-R1.dll
│ │ │ ├── sccda-R1.dll
│ │ │ ├── sccex-R1.dll
│ │ │ ├── sccfa-R1.dll
│ │ │ ├── sccfi-R1.dll
│ │ │ ├── sccfmt-R1.dll
│ │ │ ├── sccfnt-R1.dll
│ │ │ ├── sccfut-R1.dll
│ │ │ ├── sccind-R1.dll
│ │ │ ├── scclo-R1.dll
│ │ │ ├── sccut-R1.dll
│ │ │ └── wvcore-R1.dll
│ ├── packages.config
│ ├── sccfi.dll
│ ├── sccfut.dll
│ ├── scclo.dll
│ ├── sccut.dll
│ └── wvcore.dll
│ ├── Relativity.Tests.Helpers.Tests.Unit
│ ├── ImportAPI
│ │ └── ImportAPIHelperTest.cs
│ ├── Kepler
│ │ ├── ApplicationInstallHelperUnitTests.cs
│ │ └── OAuth2HelperUnitTests.cs
│ ├── LICENSE.txt
│ ├── MockHelpers
│ │ ├── MockApplicationInstallManagerHelper.cs
│ │ ├── MockHttpMessageHandlerHelper.cs
│ │ ├── MockLibraryApplicationManagerHelper.cs
│ │ ├── MockOAuth2ClientManagerHelper.cs
│ │ ├── MockObjectManagerHelper.cs
│ │ └── MockUserManagerHelper.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Relativity.Tests.Helpers.Tests.Unit.csproj
│ ├── RetryHelper
│ │ └── RetryLogicHelperUnitTests.cs
│ ├── app.config
│ ├── oi
│ │ └── unmanaged
│ │ │ ├── cmmap000.bin
│ │ │ ├── oilink.exe
│ │ │ ├── oilink.jar
│ │ │ ├── sccca-R1.dll
│ │ │ ├── sccch-R1.dll
│ │ │ ├── sccda-R1.dll
│ │ │ ├── sccex-R1.dll
│ │ │ ├── sccfa-R1.dll
│ │ │ ├── sccfi-R1.dll
│ │ │ ├── sccfmt-R1.dll
│ │ │ ├── sccfnt-R1.dll
│ │ │ ├── sccfut-R1.dll
│ │ │ ├── sccind-R1.dll
│ │ │ ├── scclo-R1.dll
│ │ │ ├── sccut-R1.dll
│ │ │ └── wvcore-R1.dll
│ └── packages.config
│ └── lib
│ ├── Relativity.Authentication.Interfaces.dll
│ ├── Relativity.dll
│ ├── kCura.Config.dll
│ ├── kCura.Crypto.dll
│ ├── kCura.Data.RowDataGateway.dll
│ ├── kCura.Data.dll
│ ├── kCura.OI.FileID.dll
│ ├── kCura.Relativity.DataReaderClient.dll
│ ├── kCura.Relativity.ImportAPI.dll
│ ├── kCura.Utility.dll
│ ├── kCura.WinEDDS.ImportExtension.dll
│ ├── kCura.WinEDDS.dll
│ └── kCura.Windows.Process.dll
├── build-pipeline.yml
├── scheduled-build-pipeline.yml
└── variables.json
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog for Relativity Test Helpers
2 |
3 | - This file is used to list changes made in the relativity-test-helpers repo.
4 | - **Place Newer updates on the top**
5 |
6 | -------------------------
7 |
8 | ## 2021-03-18
9 |
10 | - REL-535838 - Updating README for clearer breaking changes for v8.
11 |
12 |
13 | -------------------------
14 |
15 | ## 2021-03-10
16 |
17 | - REL-518415 - New version 8.1.1.1 created - Relativity.API added as a dependency, GetDbContext() set to throw NotImplementedException().
18 |
19 | -------------------------
20 |
21 | ## 2021-03-09
22 |
23 | - REL-518415 - New version 8.1.0.1 created (RSAPI removal and refactor)
24 |
25 | -------------------------
26 |
27 | ## 2021-03-08
28 |
29 | - REL-518415 - Removed Kepler Helper, RSAPI Package, and any remaining uses of RSAPI.
30 | - REL-518437 - Updated README, renamed Document to DocumentHelper, cleaned up Test Example project, removed ForceDbContext, removed KeplerHelper Kepler projects
31 |
32 | -------------------------
33 |
34 | ## 2021-03-04
35 |
36 | - REL-518429 - Removed RSAPI from User Helper classes and moved their main code into UserHelper. Updated tests as well to account for this.
37 | - Converged all usage of ServiceFactory & IServicesMgr to IServicesMgr
38 | - Removed various usages of RSAPI across many projects
39 | - Added overloaded function in TestHelpers for GetGuid to utilize ObjectManager to get Guids
40 |
41 | -------------------------
42 |
43 | ## 2021-03-03
44 |
45 | - REL-518432 - Removed RSAPI address from the Configuration Helper. Switch current uses to use Instance Address instead.
46 | - REL-530844 - Removed DbContext usage from methods in ArtifactHelpers folder.
47 |
48 | -------------------------
49 |
50 | ## 2021-03-02
51 |
52 | - REL-518430 - Removed RSAPI from Workspace classes and moved their main code into WorkspaceHelpers. Updated tests as well to account for this.
53 |
54 | -------------------------
55 |
56 | ## 2021-03-01
57 |
58 | - REL-518428 - Removed RSAPI from Group class and renamed to GroupHelper class. Also updated integration tests.
59 |
60 | -------------------------
61 |
62 | ## 2021-02-26
63 |
64 | - REL-518423 - Removed RSAPI from Folder class and renamed to FoldersHelper class. Also updated integration tests and indirect RSAPI usage in WorkspaceHelper
65 |
66 | -------------------------
67 |
68 | ## 2021-02-22
69 |
70 | - REL-518419 - Removed RSAPI from Client class and renamed to ClientHelpers class. Also updated integration tests.
71 |
72 | -------------------------
73 |
74 | ## 2021-02-15
75 |
76 | - REL-518412 - Removed NUnit dependency and deleted a constructor that accepted TestContext (an NUnit object).
77 |
--------------------------------------------------------------------------------
/Documentation/Readme.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Documentation/Readme.txt
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2016, kCura LLC
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5 |
6 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 |
8 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 |
10 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11 |
12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13 |
14 | The.dlls listed in this document are made available to you under the terms of a commercial agreement with kCura LLC. Subject to the terms of that license, You may only use them programmatically to the extent that they are referenced by the other files contained in this package. You may not access, use, or redistribute them independently of this package. You may not reverse engineer, decompile, create derivative works, translate, or disassemble these .dlls, and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation.
15 |
16 | Relativity.API.dll
17 | kCura.Relativity.Client.dll
18 | Relativity.Kepler.dll
19 | Relativity.Services.DataContracts.dll
20 | Relativity.Services.Interfaces.dll
21 | Relativity.Services.ServiceProxy.dll
22 | kCura.Data.dll
23 | kCura.ImageValidator.dll
24 | kCura.Relativity.OI.FileID.dll
25 | kCura.Relativity.DataReaderClient.dll
26 | kCura.Relativity.ImportAPI.dll
27 | kCura.Utility.dll
28 | kCura.Windows.Forms.dll
29 | kCura.WindEDDS.dll
30 | kCura.WindEDDs.ImportExtension.dll
31 | Relativity.dll
32 | kCura.EventHandler.dll
33 | kCura.Config.dll
34 | kCura.Crypto.dll
35 | kCura.RowDataGateway.dll
36 | Relativity.CustomPages.dll
37 | kCura.Agent.dll
38 | kCura.Config.dll
39 |
--------------------------------------------------------------------------------
/RelativityDev.RelativityTestHelpers.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | RelativityDev.RelativityTestHelpers
5 | 7.4.2.1
6 | RelativityDev
7 | RelativityDev
8 | https://github.com/relativitydev/relativity-test-helpers/blob/master/LICENSE
9 | https://github.com/relativitydev/relativity-test-helpers
10 | https://bit.ly/2qFJQzk
11 | true
12 | This NuGet package contains a helper library to write integration tests for testing Relativity applications. This is a community supported implementation. If this does not meet your needs for your implementation you are invited to contribute to the project.
13 | https://github.com/relativitydev/relativity-test-helpers
14 |
15 | relativity-test-helpers relativity test helpers relativity test helpers test helpers integration tests relativity integration tests
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2006 Damien Miller (jBCrypt)
2 | Copyright (c) 2013 Ryan D. Emerle (.Net port)
3 |
4 | Permission to use, copy, modify, and distribute this software for any
5 | purpose with or without fee is hereby granted, provided that the above
6 | copyright notice and this permission notice appear in all copies.
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("Relativity.Test.Helpers.Example.NUnit")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("Relativity.Test.Helpers.Example.NUnit")]
12 | [assembly: AssemblyCopyright("Copyright © 2017")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("aaa809da-ea6f-474c-b9c0-d2b6217a5702")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("7.5.3.1")]
35 | [assembly: AssemblyFileVersion("7.5.3.1")]
36 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/TestHelpers_Kepler_App.rap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/TestHelpers_Kepler_App.rap
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/TestTemplate.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using Relativity.API;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Reflection;
7 | using IServicesMgr = Relativity.API.IServicesMgr;
8 |
9 | namespace Relativity.Test.Helpers.Example.NUnit
10 | {
11 |
12 | ///
13 | ///
14 | /// Relativity Integration Test Helpers to assist you with writing good Integration Tests for your application. You can use this framework to test event handlers, agents and any workflow that combines agents and frameworks.
15 | ///
16 | /// Before you get Started, fill out details for the following the app.config file or runsettings file
17 | /// "WorkspaceID", "RelativityInstanceAddress", "RESTServerAddress", "AdminUsername","AdminPassword", "SQLServerAddress" ,"SQLUsername","SQLPassword" "TestWorkspaceName"
18 | ///
19 | ///
20 |
21 | [TestFixture, Description("Fixture description here")]
22 | public class TestTemplate
23 | {
24 |
25 | #region Variables
26 | private int _workspaceId;
27 | private string _workspaceName = $"IntTest_{Guid.NewGuid()}";
28 | private const ExecutionIdentity EXECUTION_IDENTITY = ExecutionIdentity.CurrentUser;
29 | private IServicesMgr _servicesMgr;
30 | private Int32 _numberOfDocuments = 5;
31 | private string _foldername = "Test Folder";
32 | private string _groupName = "Test Group";
33 | private int _userArtifactId;
34 | private int _groupArtifactId;
35 | private int _fixedLengthArtId;
36 | private int _longtextartid;
37 | private int _wholeNumberArtId;
38 |
39 | #endregion
40 |
41 |
42 | #region TestfixtureSetup
43 |
44 | [OneTimeSetUp]
45 | public void Execute_TestFixtureSetup()
46 | {
47 | //Setup for testing
48 | Dictionary configDictionary = new Dictionary();
49 | foreach (string testParameterName in TestContext.Parameters.Names)
50 | {
51 | configDictionary.Add(testParameterName, TestContext.Parameters[testParameterName]);
52 | }
53 | var helper = new TestHelper(configDictionary);
54 | _servicesMgr = helper.GetServicesManager();
55 |
56 | //Create new user
57 | _userArtifactId = Relativity.Test.Helpers.UserHelpers.UserHelper.Create(helper.GetServicesManager());
58 |
59 | //Create new group
60 | Relativity.Test.Helpers.GroupHelpers.GroupHelper.CreateGroup(_servicesMgr, _groupName);
61 |
62 |
63 | //Create workspace
64 | _workspaceId = Helpers.WorkspaceHelpers.WorkspaceHelpers.CreateAsync(_servicesMgr, _workspaceName, SharedTestHelpers.ConfigurationHelper.TEST_WORKSPACE_TEMPLATE_NAME).ConfigureAwait(false).GetAwaiter().GetResult();
65 |
66 | var executableLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
67 | var nativeFilePath = "";
68 | var nativeName = @"\\\\FakeFilePath\Natives\SampleTextFile.txt";
69 | if (executableLocation != null)
70 | {
71 | nativeFilePath = Path.Combine(executableLocation, nativeName);
72 | }
73 | //Create Documents with a given folder name
74 | Relativity.Test.Helpers.ImportAPIHelper.ImportAPIHelper.CreateDocumentswithFolderName(_workspaceId, _numberOfDocuments, _foldername, nativeFilePath);
75 |
76 | //Create Documents with a given folder artifact id
77 | Relativity.Test.Helpers.ImportAPIHelper.ImportAPIHelper.CreateDocumentswithFolderName(_workspaceId, _numberOfDocuments, _foldername, nativeFilePath);
78 |
79 | //Create Fixed Length field
80 | _fixedLengthArtId = Relativity.Test.Helpers.ArtifactHelpers.FieldHelper.CreateFieldFixedLengthText(_servicesMgr, _workspaceId);
81 |
82 | //Create Long Text Field
83 | _longtextartid = Relativity.Test.Helpers.ArtifactHelpers.FieldHelper.CreateFieldLongText(_servicesMgr, _workspaceId);
84 |
85 | //Create Whole number field
86 | _wholeNumberArtId = Relativity.Test.Helpers.ArtifactHelpers.FieldHelper.CreateFieldWholeNumber(_servicesMgr, _workspaceId);
87 |
88 | Guid workspaceGuid = helper.GetGuid(-1, _workspaceId, Constants.ArtifactTypeIds.Workspace);
89 | }
90 |
91 | #endregion
92 |
93 | #region TestfixtureTeardown
94 |
95 |
96 | [OneTimeTearDown]
97 | public void Execute_TestFixtureTeardown()
98 | {
99 | //Delete Workspace
100 | WorkspaceHelpers.WorkspaceHelpers.Delete(_servicesMgr, _workspaceId);
101 |
102 | //Delete User
103 | UserHelpers.UserHelper.Delete(_servicesMgr, _userArtifactId);
104 |
105 | //Delete Group
106 | GroupHelpers.GroupHelper.DeleteGroup(_servicesMgr, _groupArtifactId);
107 | }
108 |
109 |
110 | #endregion
111 |
112 | #region region Golden Flow
113 |
114 | [Test, Description("Test description here")]
115 | public void Integration_Test_Golden_Flow_Valid()
116 | {
117 | //Arrange
118 |
119 | //Act
120 |
121 | //Assert
122 |
123 | }
124 |
125 | #endregion
126 |
127 | }
128 |
129 | }
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/cmmap000.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/cmmap000.bin
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/oilink.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/oilink.exe
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/oilink.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/oilink.jar
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccca-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccca-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccch-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccch-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccda-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccda-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccex-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccex-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccfa-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccfa-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccfi-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccfi-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccfmt-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccfmt-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccfnt-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccfnt-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccfut-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccfut-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccind-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccind-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/scclo-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/scclo-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccut-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/sccut-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/wvcore-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/oi/unmanaged/wvcore-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.Example.NUnit/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/ArtifactHelpers/ClientHelperIntegrationTests.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using Relativity.API;
3 | using Relativity.Test.Helpers.ArtifactHelpers;
4 | using System;
5 | using System.Collections.Generic;
6 |
7 | namespace Relativity.Test.Helpers.NUnit.Integration.ArtifactHelpers
8 | {
9 | [TestFixture]
10 | public class ClientHelperIntegrationTests
11 | {
12 | private IHelper _testHelper;
13 | private IServicesMgr _servicesMgr;
14 | private int _clientArtifactId;
15 | const string _clientName = "TestClientName";
16 |
17 |
18 | [SetUp]
19 | public void SetUp()
20 | {
21 | Dictionary configDictionary = new Dictionary();
22 | foreach (string testParameterName in TestContext.Parameters.Names)
23 | {
24 | configDictionary.Add(testParameterName, TestContext.Parameters[testParameterName]);
25 | }
26 | _testHelper = new TestHelper(configDictionary);
27 | _servicesMgr = _testHelper.GetServicesManager();
28 | }
29 |
30 | [TearDown]
31 | public void TearDown()
32 | {
33 | if (_clientArtifactId != 0)
34 | {
35 | ClientHelper.DeleteClient(_servicesMgr, _clientArtifactId);
36 | }
37 |
38 | _clientArtifactId = 0;
39 | _testHelper = null;
40 | _servicesMgr = null;
41 | }
42 |
43 | [Test]
44 | public void CreateClientTest()
45 | {
46 | _clientArtifactId = ClientHelper.CreateClient(_servicesMgr, _clientName);
47 |
48 | Assert.Greater(_clientArtifactId, 0);
49 | }
50 |
51 | [Test]
52 | public void CreateClientTest_Failure()
53 | {
54 | Assert.Throws(() => ClientHelper.CreateClient(_servicesMgr, null));
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/ArtifactHelpers/DocumentHelperIntegrationTests.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using Relativity.API;
3 | using Relativity.Test.Helpers.ArtifactHelpers;
4 | using System;
5 | using System.Collections.Generic;
6 |
7 | namespace Relativity.Test.Helpers.NUnit.Integration.ArtifactHelpers
8 | {
9 | [TestFixture]
10 | public class DocumentHelperIntegrationTests
11 | {
12 | private IHelper testHelper;
13 | private string _workspaceName;
14 | private IServicesMgr _servicesManager;
15 | private int _workspaceId;
16 |
17 | [SetUp]
18 | public void SetUp()
19 | {
20 | Dictionary configDictionary = new Dictionary();
21 | foreach (string testParameterName in TestContext.Parameters.Names)
22 | {
23 | configDictionary.Add(testParameterName, TestContext.Parameters[testParameterName]);
24 | }
25 | testHelper = new TestHelper(configDictionary);
26 | _workspaceName = $"IntTest_{Guid.NewGuid()}";
27 | _servicesManager = testHelper.GetServicesManager();
28 | _workspaceId = Helpers.WorkspaceHelpers.WorkspaceHelpers.CreateAsync(_servicesManager, _workspaceName, SharedTestHelpers.ConfigurationHelper.TEST_WORKSPACE_TEMPLATE_NAME).ConfigureAwait(false).GetAwaiter().GetResult();
29 | }
30 |
31 | [TearDown]
32 | public void TearDown()
33 | {
34 | //Delete Workspace
35 | Helpers.WorkspaceHelpers.WorkspaceHelpers.Delete(_servicesManager, _workspaceId);
36 |
37 | testHelper = null;
38 | _servicesManager = null;
39 | }
40 |
41 |
42 | [Test]
43 | public void GetDocumentIdentifierFieldName()
44 | {
45 | // Arrange
46 | const int fieldArtifactTypeId = 14;
47 | const string controlNumber = "Control Number";
48 |
49 | // Act
50 | string fieldName = "";
51 | fieldName = DocumentHelper.GetDocumentIdentifierFieldName(_servicesManager, _workspaceId, fieldArtifactTypeId);
52 |
53 | // Assert
54 | Assert.AreEqual(controlNumber, fieldName);
55 | }
56 |
57 | [Test]
58 | public void GetDocumentIdentifierFieldName_InvalidFieldType()
59 | {
60 | // Arrange
61 | const int fieldArtifactTypeId = 0;
62 |
63 | // Act / Assert
64 | string fieldName = "";
65 | Assert.Throws(() =>
66 | DocumentHelper.GetDocumentIdentifierFieldName(_servicesManager, _workspaceId, fieldArtifactTypeId));
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/ArtifactHelpers/FoldersHelperIntegrationTests.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using Relativity.API;
3 | using Relativity.Test.Helpers.ArtifactHelpers;
4 | using Relativity.Test.Helpers.Exceptions;
5 | using Relativity.Test.Helpers.SharedTestHelpers;
6 | using System;
7 | using System.Collections.Generic;
8 |
9 | namespace Relativity.Test.Helpers.NUnit.Integration.ArtifactHelpers
10 | {
11 | [TestFixture]
12 | public class FoldersHelperIntegrationTests
13 | {
14 | private IHelper testHelper;
15 | private int _workspaceId;
16 | private IServicesMgr _servicesManager;
17 | private string _workspaceName;
18 |
19 | [OneTimeSetUp]
20 | public void SetUp()
21 | {
22 | Dictionary configDictionary = new Dictionary();
23 | foreach (string testParameterName in TestContext.Parameters.Names)
24 | {
25 | configDictionary.Add(testParameterName, TestContext.Parameters[testParameterName]);
26 | }
27 | testHelper = new TestHelper(configDictionary);
28 |
29 | _workspaceName = $"IntTest_{Guid.NewGuid()}";
30 | _servicesManager = testHelper.GetServicesManager();
31 | _workspaceId = Helpers.WorkspaceHelpers.WorkspaceHelpers.CreateAsync(_servicesManager, _workspaceName, SharedTestHelpers.ConfigurationHelper.TEST_WORKSPACE_TEMPLATE_NAME).ConfigureAwait(false).GetAwaiter().GetResult();
32 | }
33 |
34 | [OneTimeTearDown]
35 | public void TearDown()
36 | {
37 | //Delete Workspace
38 | Helpers.WorkspaceHelpers.WorkspaceHelpers.Delete(_servicesManager, _workspaceId);
39 |
40 | testHelper = null;
41 | _servicesManager = null;
42 | }
43 |
44 | [Test]
45 | public void GetFolderNameTest()
46 | {
47 | // Arrange
48 | int rootFolderArtifactId = FoldersHelper.GetRootFolderArtifactID(_workspaceId, _servicesManager,
49 | ConfigurationHelper.ADMIN_USERNAME, ConfigurationHelper.DEFAULT_PASSWORD);
50 |
51 | // Act
52 | string folderName = "";
53 | folderName = FoldersHelper.GetFolderName(_servicesManager, rootFolderArtifactId, _workspaceId);
54 |
55 | // Assert
56 | Assert.AreEqual(_workspaceName, folderName);
57 | }
58 |
59 | [Test]
60 | public void CreateFolderTest()
61 | {
62 | var testFolderName = "test_folder";
63 | int folderArtifactId = FoldersHelper.CreateFolder(_servicesManager, _workspaceId, testFolderName);
64 |
65 | Assert.IsNotNull(folderArtifactId);
66 | }
67 |
68 | [Test]
69 | public void CreateFolderTest_Failure()
70 | {
71 | Assert.Throws(() => FoldersHelper.CreateFolder(_servicesManager, _workspaceId, null));
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/Files/FakeApp.rap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/Files/FakeApp.rap
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/GroupHelpers/GroupHelpersIntegrationTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using NUnit.Framework;
7 | using Relativity.API;
8 | using Relativity.Services.Interfaces.Group;
9 | using Relativity.Services.Objects;
10 | using Relativity.Services.Objects.DataContracts;
11 | using Relativity.Services.ServiceProxy;
12 | using Relativity.Test.Helpers.SharedTestHelpers;
13 |
14 | namespace Relativity.Test.Helpers.NUnit.Integration.GroupHelpers
15 | {
16 | [TestFixture]
17 | public class GroupHelpersIntegrationTests
18 | {
19 | private IHelper testHelper;
20 | private IServicesMgr _servicesMgr;
21 | private string groupName = "Test Helpers Integration Test Group";
22 |
23 | [SetUp]
24 | public void SetUp()
25 | {
26 | Dictionary configDictionary = new Dictionary();
27 | foreach (string testParameterName in TestContext.Parameters.Names)
28 | {
29 | configDictionary.Add(testParameterName, TestContext.Parameters[testParameterName]);
30 | }
31 | testHelper = new TestHelper(configDictionary);
32 | _servicesMgr = testHelper.GetServicesManager();
33 | CleanUpTestGroups();
34 | }
35 |
36 | [TearDown]
37 | public void TearDown()
38 | {
39 | testHelper = null;
40 | _servicesMgr = null;
41 | }
42 |
43 | [Test]
44 | public void CreateGroupAndDeleteGroupTest()
45 | {
46 | // Act
47 | int groupArtifactId = Relativity.Test.Helpers.GroupHelpers.GroupHelper.CreateGroup(_servicesMgr, groupName);
48 | bool deleteGroupResult = Relativity.Test.Helpers.GroupHelpers.GroupHelper.DeleteGroup(_servicesMgr, groupArtifactId);
49 |
50 | // Assert
51 | Assert.IsTrue(groupArtifactId > 0);
52 | Assert.IsTrue(deleteGroupResult);
53 | }
54 |
55 | public void CleanUpTestGroups()
56 | {
57 | try
58 | {
59 | using (IObjectManager objectManager = _servicesMgr.CreateProxy(ExecutionIdentity.CurrentUser))
60 | {
61 | QueryRequest clientQueryRequest = new QueryRequest
62 | {
63 | ObjectType = new ObjectTypeRef
64 | {
65 | ArtifactTypeID = 3
66 | },
67 | Condition = $"'Name' == '{groupName}'"
68 | };
69 | Services.Objects.DataContracts.QueryResult queryResult = objectManager.QueryAsync(-1, clientQueryRequest, 0, 10).GetAwaiter().GetResult();
70 | if (queryResult.TotalCount > 0)
71 | {
72 | foreach (var obj in queryResult.Objects)
73 | {
74 | using (IGroupManager groupManager = _servicesMgr.CreateProxy(ExecutionIdentity.CurrentUser))
75 | {
76 | groupManager.DeleteAsync(obj.ArtifactID).Wait();
77 | }
78 | }
79 | }
80 | }
81 | }
82 | catch (Exception ex)
83 | {
84 | throw new Exception("Error Cleaning Up Test Groups", ex);
85 | }
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/Mail/GmailMailHelperTests.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using Relativity.Test.Helpers.Mail;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Net;
7 | using System.Net.Mail;
8 |
9 | namespace Relativity.Test.Helpers.NUnit.Integration.Mail
10 | {
11 | [TestFixture, Ignore("Failing on Azure Pipelines")]
12 | public class GmailMailHelperTests
13 | {
14 | private IMailHelper Sut;
15 |
16 | ///
17 | /// You will need to have a Gmail account setup with IMAP
18 | ///
19 | private const string EmailTestSubject = "Relativity Integration Test";
20 | private const string EmailTestBody = "Relativity test email for integration tests";
21 | private const string EmailTestDisplayName = "Relativity ODA";
22 | private const int EmailPort = 587;
23 | private const string EmailDomain = "smtp.gmail.com";
24 |
25 | // The following below should be changed for this test
26 | private readonly string EmailAddress = TestContext.Parameters["GmailMailTestEmailAddress"];
27 | private readonly string EmailPassword = TestContext.Parameters["GmailMailTestEmailPassword"];
28 |
29 | [OneTimeSetUp]
30 | public void SetUp()
31 | {
32 | Sut = new GmailMailHelper(EmailAddress, EmailPassword);
33 | }
34 |
35 | [OneTimeTearDown]
36 | public void TearDown()
37 | {
38 | Sut = null;
39 | }
40 |
41 | [Test]
42 | public void GetInboxes()
43 | {
44 | // Arrange
45 |
46 | // Act
47 | List inboxes = Sut.GetInboxes();
48 |
49 | // Assert
50 | Assert.NotNull(inboxes.First());
51 | Assert.Greater(inboxes.Count, 0);
52 | Assert.IsFalse(string.IsNullOrEmpty(inboxes.First().Id));
53 | }
54 |
55 | [Test]
56 | public void GetMessages()
57 | {
58 | // Arrange
59 | List inboxes = Sut.GetInboxes();
60 |
61 | SendMail();
62 |
63 | // Act
64 | List messages = Sut.GetMessagesInInbox(inboxes.First());
65 |
66 | // Assert
67 | Assert.NotNull(inboxes.First());
68 | Assert.NotNull(messages.First());
69 | Assert.Greater(messages.Count, 0);
70 | Assert.IsFalse(string.IsNullOrEmpty(messages.First().Id));
71 |
72 | IMailMessageModel message = Sut.DeleteMessage(inboxes.First(), messages.First().Id);
73 | }
74 |
75 | [Test]
76 | public void GetMessage()
77 | {
78 | // Arrange
79 | string textToFind = EmailTestBody.ToLower();
80 |
81 | List inboxes = Sut.GetInboxes();
82 | IMailInboxModel inbox = inboxes.First();
83 |
84 | SendMail();
85 |
86 | List messages = Sut.GetMessagesInInbox(inbox);
87 | string messageId = messages.First().Id;
88 |
89 | // Act
90 | IMailMessageModel message = Sut.GetMessage(inbox, messageId);
91 |
92 | // Assert
93 | Assert.NotNull(message.Body);
94 | Assert.IsTrue(message.Body.ToLower().Contains(textToFind));
95 | Assert.IsTrue(message.Subject.Equals(EmailTestSubject, StringComparison.OrdinalIgnoreCase));
96 | Assert.IsTrue(message.FromEmail.Contains(EmailAddress));
97 | Assert.IsTrue(message.ToEmail.Contains(EmailAddress));
98 | message = Sut.DeleteMessage(inbox, messageId);
99 | }
100 |
101 | [Test]
102 | //[Test, Ignore("Ignored for now until Google consents to full API access. Fun stuff")]
103 | public void DeleteMessage()
104 | {
105 | // Arrange
106 | List inboxes = Sut.GetInboxes();
107 | IMailInboxModel inbox = inboxes.First();
108 |
109 | SendMail();
110 |
111 | List messages = Sut.GetMessagesInInbox(inbox);
112 | string messageId = messages.First().Id;
113 |
114 | // Act
115 | IMailMessageModel message = Sut.DeleteMessage(inbox, messageId);
116 |
117 | // Assert
118 | Assert.NotNull(message.Id);
119 | Assert.IsTrue(message.Id == messageId);
120 | }
121 |
122 | public void SendMail()
123 | {
124 | MailAddress fromAddress = new MailAddress(EmailAddress, EmailTestDisplayName);
125 | MailAddress toAddress = new MailAddress(EmailAddress, EmailTestDisplayName);
126 | const string subject = EmailTestSubject;
127 | const string body = EmailTestBody;
128 |
129 | SmtpClient smtpClient = new SmtpClient
130 | {
131 | Host = EmailDomain,
132 | Port = EmailPort,
133 | EnableSsl = true,
134 | DeliveryMethod = SmtpDeliveryMethod.Network,
135 | UseDefaultCredentials = false,
136 | Credentials = new NetworkCredential(fromAddress.Address, EmailPassword)
137 | };
138 | using (MailMessage message = new MailMessage(fromAddress, toAddress)
139 | {
140 | Subject = subject,
141 | Body = body
142 | })
143 | {
144 | smtpClient.Send(message);
145 | }
146 | }
147 | }
148 | }
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("Relativity.Test.Helpers.NUnit.Integration")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("Relativity.Test.Helpers.NUnit.Integration")]
12 | [assembly: AssemblyCopyright("Copyright © 2019")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("d1830fe3-416f-4368-bc9c-b230feae9172")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("7.5.3.1")]
35 | [assembly: AssemblyFileVersion("7.5.3.1")]
36 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/RetryHelper/RetryLogicHelperTests.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using Relativity.Test.Helpers.Exceptions;
3 | using Relativity.Test.Helpers.RetryHelper;
4 | using System;
5 | using System.Threading.Tasks;
6 |
7 | namespace Relativity.Test.Helpers.NUnit.Integration.RetryHelper
8 | {
9 | [TestFixture]
10 | public class RetryLogicHelperTests
11 | {
12 | private RetryLogicHelper SuT;
13 |
14 | [SetUp]
15 | public void SetUp()
16 | {
17 | SuT = new RetryLogicHelper();
18 | }
19 |
20 | [TearDown]
21 | public void TearDown()
22 | {
23 |
24 | }
25 |
26 | [TestCase(0, 0)]
27 | [TestCase(2, 2)]
28 | public void RetryFunction_Return_Valid(int numberOfRetries, int delayInSeconds)
29 | {
30 | // Arrange
31 | // Act
32 | int result = SuT.RetryFunction(numberOfRetries, delayInSeconds, TestFunction);
33 |
34 | // Assert
35 | Assert.AreEqual(10, result);
36 | }
37 |
38 | [TestCase(-1, 2)]
39 | [TestCase(2, -1)]
40 | public void RetryFunction_Return_Invalid(int numberOfRetries, int delayInSeconds)
41 | {
42 | // Arrange
43 | // Act
44 | // Assert
45 | Assert.Throws(() => { SuT.RetryFunction(numberOfRetries, delayInSeconds, TestFunction); });
46 | }
47 |
48 | [TestCase(0, 0)]
49 | [TestCase(2, 2)]
50 | public async Task RetryFunctionAsync_Return_Valid(int numberOfRetries, int delayInSeconds)
51 | {
52 | // Arrange
53 | // Act
54 | int result = await SuT.RetryFunctionAsync(numberOfRetries, delayInSeconds, TestFunctionAsync);
55 |
56 | // Assert
57 | Assert.AreEqual(10, result);
58 | }
59 |
60 | [TestCase(-1, 2)]
61 | [TestCase(2, -1)]
62 | public async Task RetryFunctionAsync_Return_Invalid(int numberOfRetries, int delayInSeconds)
63 | {
64 | // Arrange
65 | await Task.Yield();
66 |
67 | // Act
68 | // Assert
69 | Assert.ThrowsAsync(async () => { await SuT.RetryFunctionAsync(numberOfRetries, delayInSeconds, TestFunctionAsync); });
70 | }
71 |
72 | [TestCase(0, 0)]
73 | [TestCase(2, 2)]
74 | public void RetryFunction_Void_Valid(int numberOfRetries, int delayInSeconds)
75 | {
76 | // Arrange
77 | // Act
78 | // Assert
79 | Assert.DoesNotThrow(() => { SuT.RetryFunction(numberOfRetries, delayInSeconds, BasicVoidReturnFunction); });
80 | }
81 |
82 | [TestCase(-1, 2)]
83 | [TestCase(2, -1)]
84 | public void RetryFunction_Void_Invalid(int numberOfRetries, int delayInSeconds)
85 | {
86 | // Arrange
87 | // Act
88 | // Assert
89 | Assert.Throws(() => { SuT.RetryFunction(numberOfRetries, delayInSeconds, BasicVoidReturnFunction); });
90 | }
91 |
92 | [TestCase(0, 0)]
93 | [TestCase(2, 2)]
94 | public async Task RetryFunctionAsync_Void_Valid(int numberOfRetries, int delayInSeconds)
95 | {
96 | // Arrange
97 | await Task.Yield();
98 |
99 | // Act
100 | // Assert
101 | Assert.DoesNotThrowAsync(async () => { await SuT.RetryFunctionAsync(numberOfRetries, delayInSeconds, BasicVoidReturnFunctionAsync); });
102 | }
103 |
104 | [TestCase(0, 0)]
105 | [TestCase(2, 2)]
106 | public async Task RetryFunctionAsync_Void_Invalid(int numberOfRetries, int delayInSeconds)
107 | {
108 | // Arrange
109 | await Task.Yield();
110 |
111 | // Act
112 | // Assert
113 | Assert.DoesNotThrowAsync(async () => { await SuT.RetryFunctionAsync(numberOfRetries, delayInSeconds, BasicVoidReturnFunctionAsync); });
114 | }
115 |
116 | public int TestFunction()
117 | {
118 | return 10;
119 | }
120 |
121 | public async Task TestFunctionAsync()
122 | {
123 | return await Task.FromResult(10);
124 | }
125 |
126 | public void BasicVoidReturnFunction()
127 | {
128 | Console.WriteLine("Void Return Function called");
129 | }
130 |
131 | public async Task BasicVoidReturnFunctionAsync()
132 | {
133 | await Task.Yield();
134 | Console.WriteLine("Void Return Function called");
135 | }
136 | }
137 | }
138 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/TestConstants.cs:
--------------------------------------------------------------------------------
1 | namespace Relativity.Test.Helpers.NUnit.Integration
2 | {
3 | public class TestConstants
4 | {
5 | public class Config
6 | {
7 | public static string RemoteAppConfigName = "remoteAppSettings";
8 | }
9 |
10 | public class Database
11 | {
12 | public static string EddsDatabaseName = "EDDS";
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/TestEHHelperIntegrationTests.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using Relativity.API;
3 | using Relativity.Test.Helpers.HelperClasses;
4 | using Relativity.Test.Helpers.SharedTestHelpers;
5 | using System;
6 |
7 | namespace Relativity.Test.Helpers.NUnit.Integration
8 | {
9 | [TestFixture]
10 | public class TestEHHelperIntegrationTests
11 | {
12 | private IEHHelper SuT;
13 |
14 | [OneTimeSetUp]
15 | public void SetUp()
16 | {
17 | SuT = new TestEHHelper(ConfigurationHelper.ADMIN_USERNAME, ConfigurationHelper.DEFAULT_PASSWORD);
18 | }
19 |
20 | [OneTimeTearDown]
21 | public void TearDown()
22 | {
23 | SuT = null;
24 | }
25 |
26 | [Test]
27 | public void GetAuthenticationManagerTest()
28 | {
29 | // Arrange
30 | int userId = 0;
31 |
32 | // Act
33 | IAuthenticationMgr authenticationManager = SuT.GetAuthenticationManager();
34 | userId = authenticationManager.UserInfo.ArtifactID;
35 | Console.WriteLine($"GetAuthenticationManagerTest: userId = {userId}");
36 |
37 | // Assert
38 | Assert.IsTrue(userId > 0);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/TestHelperIntegrationTests.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using Relativity.API;
3 | using System;
4 | using System.Collections.Generic;
5 |
6 | namespace Relativity.Test.Helpers.NUnit.Integration
7 | {
8 | [TestFixture]
9 | public class TestHelperIntegrationTests
10 | {
11 | private IHelper SuT;
12 | private int _workspaceOneId;
13 | private int _workspaceTwoId;
14 | private IServicesMgr _servicesManager;
15 | private readonly string _workspaceName = $"IntTest_{Guid.NewGuid()}";
16 | private ILogFactory _logFactory;
17 |
18 | [OneTimeSetUp]
19 | public void SetUp()
20 | {
21 | //Arrange
22 | Dictionary configDictionary = new Dictionary();
23 | foreach (string testParameterName in TestContext.Parameters.Names)
24 | {
25 | configDictionary.Add(testParameterName, TestContext.Parameters[testParameterName]);
26 | }
27 | SuT = new TestHelper(configDictionary);
28 |
29 | _servicesManager = SuT.GetServicesManager();
30 | _workspaceOneId = Helpers.WorkspaceHelpers.WorkspaceHelpers.CreateAsync(_servicesManager, _workspaceName, SharedTestHelpers.ConfigurationHelper.TEST_WORKSPACE_TEMPLATE_NAME).ConfigureAwait(false).GetAwaiter().GetResult();
31 | _workspaceTwoId = Helpers.WorkspaceHelpers.WorkspaceHelpers.CreateAsync(_servicesManager, _workspaceName, SharedTestHelpers.ConfigurationHelper.TEST_WORKSPACE_TEMPLATE_NAME).ConfigureAwait(false).GetAwaiter().GetResult();
32 | }
33 |
34 | [OneTimeTearDown]
35 | public void TearDown()
36 | {
37 | //Delete Workspaces
38 | Helpers.WorkspaceHelpers.WorkspaceHelpers.Delete(_servicesManager, _workspaceOneId);
39 | Helpers.WorkspaceHelpers.WorkspaceHelpers.Delete(_servicesManager, _workspaceTwoId);
40 |
41 | _servicesManager = null;
42 | SuT = null;
43 | }
44 |
45 | [Test]
46 | public void GetLoggerFactoryTest()
47 | {
48 | // Act
49 | _logFactory = SuT.GetLoggerFactory();
50 | _logFactory.GetLogger().LogDebug("GetLoggerFactoryTest: Test Log");
51 |
52 | // Assert
53 | Assert.IsTrue(_logFactory != null);
54 | }
55 |
56 | [Test]
57 | public void GetGuidTest()
58 | {
59 | // Act
60 | // Get the Guid of the workspace
61 | Guid guidOne = SuT.GetGuid(-1, _workspaceOneId);
62 | Guid guidTwo = SuT.GetGuid(-1, _workspaceTwoId);
63 |
64 | // Assert
65 | Assert.NotNull(guidOne);
66 | Assert.AreNotEqual(new Guid("00000000-0000-0000-0000-000000000000"), guidOne);
67 |
68 | Assert.NotNull(guidTwo);
69 | Assert.AreNotEqual(new Guid("00000000-0000-0000-0000-000000000000"), guidTwo);
70 |
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/TestHelperRunSettingsIntegrationTests.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using Relativity.API;
3 | using Relativity.Test.Helpers.SharedTestHelpers;
4 | using System;
5 | using System.Collections.Generic;
6 |
7 | namespace Relativity.Test.Helpers.NUnit.Integration
8 | {
9 | [TestFixture]
10 | public class TestHelperRunSettingsIntegrationTests
11 | {
12 | private IHelper SuT;
13 | private bool useDbContext;
14 |
15 | [OneTimeSetUp]
16 | public void SetUp()
17 | {
18 | Dictionary configDictionary = new Dictionary();
19 | foreach (string testParameterName in TestContext.Parameters.Names)
20 | {
21 | configDictionary.Add(testParameterName, TestContext.Parameters[testParameterName]);
22 | }
23 |
24 | SuT = new TestHelper(configDictionary);
25 | }
26 |
27 | [OneTimeTearDown]
28 | public void TearDown()
29 | {
30 | SuT = null;
31 | }
32 |
33 | [Test]
34 | public void GetLoggerFactoryTest()
35 | {
36 | // Arrange
37 | ILogFactory logFactory;
38 |
39 | // Act
40 | logFactory = SuT.GetLoggerFactory();
41 | logFactory.GetLogger().LogDebug("GetLoggerFactoryTest: Test Log");
42 |
43 | // Assert
44 | Assert.IsTrue(logFactory != null);
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/TestHelpers_Kepler_App.rap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/TestHelpers_Kepler_App.rap
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/TestImportApiHelper.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using Relativity.API;
3 | using Relativity.Services.Objects;
4 | using Relativity.Services.Objects.DataContracts;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.IO;
8 | using System.Reflection;
9 | using System.Threading.Tasks;
10 |
11 | namespace Relativity.Test.Helpers.NUnit.Integration
12 | {
13 | [TestFixture]
14 | public class TestImportApiHelper
15 | {
16 | private TestHelper Sut;
17 |
18 | [OneTimeSetUp]
19 | public void Setup()
20 | {
21 | Dictionary configDictionary = new Dictionary();
22 | foreach (string testParameterName in TestContext.Parameters.Names)
23 | {
24 | configDictionary.Add(testParameterName, TestContext.Parameters[testParameterName]);
25 | }
26 | Sut = new TestHelper(configDictionary);
27 | }
28 |
29 | [OneTimeTearDown]
30 | public void Teardown()
31 | {
32 | Sut = null;
33 | }
34 |
35 | [Test]
36 | public void CreateDocumentsWithFolderName()
37 | {
38 | // Arrange
39 | int workspaceId;
40 | int numberOfDocumentsToCreate = 5;
41 | string sampleWorkspaceName = "Integration Test Workspace";
42 | string folderName = "Sample Folder";
43 | string executableLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
44 | string nativeName = @"\\\\FakeFilePath\Natives\SampleTextFile.txt";
45 | string nativeFilePath = "";
46 | int numberOfDocumentsCreated = 0;
47 | if (executableLocation != null)
48 | {
49 | nativeFilePath = Path.Combine(executableLocation, nativeName);
50 | }
51 |
52 | // Act
53 | try
54 | {
55 | workspaceId = Helpers.WorkspaceHelpers.WorkspaceHelpers.CreateAsync(Sut.GetServicesManager(), sampleWorkspaceName, SharedTestHelpers.ConfigurationHelper.TEST_WORKSPACE_TEMPLATE_NAME).ConfigureAwait(false).GetAwaiter().GetResult();
56 |
57 | Relativity.Test.Helpers.ImportAPIHelper.ImportAPIHelper.CreateDocumentswithFolderName(workspaceId, numberOfDocumentsToCreate, folderName, nativeFilePath);
58 |
59 | using (IObjectManager objectManager = Sut.GetServicesManager().CreateProxy(ExecutionIdentity.System))
60 | {
61 | QueryRequest queryRequest = new QueryRequest()
62 | {
63 | ObjectType = new ObjectTypeRef { ArtifactTypeID = Constants.ArtifactTypeIds.Document },
64 | Fields = new List()
65 | {
66 | new FieldRef { Name = "Name" }
67 | },
68 | };
69 | QueryResult result = objectManager.QueryAsync(workspaceId, queryRequest, 1, 1000).ConfigureAwait(false).GetAwaiter().GetResult();
70 | numberOfDocumentsCreated = result.Objects.Count;
71 | }
72 |
73 | Helpers.WorkspaceHelpers.WorkspaceHelpers.Delete(Sut.GetServicesManager(), workspaceId);
74 | }
75 | catch (Exception ex)
76 | {
77 | throw new Exception("An error occurred", ex);
78 | }
79 |
80 | // Assert
81 | Assert.AreEqual(numberOfDocumentsToCreate, numberOfDocumentsCreated);
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/WorkspaceHelpers/CreateWorkspaceHelperTests.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using Relativity.API;
3 | using System;
4 | using System.Collections.Generic;
5 |
6 | namespace Relativity.Test.Helpers.NUnit.Integration.WorkspaceHelpers
7 | {
8 | [TestFixture]
9 | public class CreateWorkspaceHelperTests
10 | {
11 | private int _workspaceId;
12 | private string _workspaceName = $"IntTest_{Guid.NewGuid()}";
13 | private IServicesMgr _servicesManager;
14 | private IHelper _testHelper;
15 |
16 | [OneTimeSetUp]
17 | public void SetUp()
18 | {
19 | Dictionary configDictionary = new Dictionary();
20 | foreach (string testParameterName in TestContext.Parameters.Names)
21 | {
22 | configDictionary.Add(testParameterName, TestContext.Parameters[testParameterName]);
23 | }
24 | _testHelper = new TestHelper(configDictionary);
25 | _servicesManager = _testHelper.GetServicesManager();
26 | }
27 |
28 | [OneTimeTearDown]
29 | public void Teardown()
30 | {
31 | Helpers.WorkspaceHelpers.WorkspaceHelpers.Delete(_servicesManager, _workspaceId);
32 | _testHelper = null;
33 | _servicesManager = null;
34 | }
35 |
36 | [Test]
37 | public void CreateWorkspaceTest()
38 | {
39 | _workspaceId = Helpers.WorkspaceHelpers.WorkspaceHelpers.CreateAsync(_servicesManager, _workspaceName, SharedTestHelpers.ConfigurationHelper.TEST_WORKSPACE_TEMPLATE_NAME).ConfigureAwait(false).GetAwaiter().GetResult();
40 | Assert.IsNotNull(_workspaceId);
41 | }
42 |
43 | [Test]
44 | public void CreateWorkspaceTest_Failure()
45 | {
46 | var badTemplateName = "00template00";
47 | Assert.Throws(() =>
48 | Helpers.WorkspaceHelpers.WorkspaceHelpers.CreateAsync(_servicesManager, _workspaceName, badTemplateName).Wait()
49 | );
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/WorkspaceHelpers/DeleteWorkspaceHelperTests.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using Relativity.API;
3 | using System;
4 | using System.Collections.Generic;
5 |
6 | namespace Relativity.Test.Helpers.NUnit.Integration.WorkspaceHelpers
7 | {
8 | [TestFixture]
9 | public class DeleteWorkspaceHelperTests
10 | {
11 | private int _workspaceId;
12 | private string _workspaceName = $"IntTest_{Guid.NewGuid()}";
13 | private IServicesMgr _servicesManager;
14 | private IHelper _testHelper;
15 |
16 | [OneTimeSetUp]
17 | public void SetUp()
18 | {
19 | Dictionary configDictionary = new Dictionary();
20 | foreach (string testParameterName in TestContext.Parameters.Names)
21 | {
22 | configDictionary.Add(testParameterName, TestContext.Parameters[testParameterName]);
23 | }
24 | _testHelper = new TestHelper(configDictionary);
25 | _servicesManager = _testHelper.GetServicesManager();
26 |
27 | _workspaceId = Helpers.WorkspaceHelpers.WorkspaceHelpers.CreateAsync(_servicesManager, _workspaceName, SharedTestHelpers.ConfigurationHelper.TEST_WORKSPACE_TEMPLATE_NAME).ConfigureAwait(false).GetAwaiter().GetResult();
28 | }
29 |
30 | [OneTimeTearDown]
31 | public void Teardown()
32 | {
33 | _testHelper = null;
34 | _servicesManager = null;
35 | }
36 |
37 | [Test]
38 | public void DeleteWorkspaceTest()
39 | {
40 | var success = Helpers.WorkspaceHelpers.WorkspaceHelpers.Delete(_servicesManager, _workspaceId);
41 |
42 | Assert.IsTrue(success);
43 | }
44 |
45 | [Test]
46 | public void DeleteWorkspaceTest_Failure()
47 | {
48 | var success = Helpers.WorkspaceHelpers.WorkspaceHelpers.Delete(_servicesManager, 0);
49 |
50 | Assert.IsFalse(success);
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/WorkspaceHelpers/GetWorkspaceHelperTests.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using Relativity.API;
3 | using Relativity.Test.Helpers.Exceptions;
4 | using System;
5 | using System.Collections.Generic;
6 |
7 | namespace Relativity.Test.Helpers.NUnit.Integration.WorkspaceHelpers
8 | {
9 | [TestFixture]
10 | public class GetWorkspaceHelperTests
11 | {
12 | private int _workspaceId;
13 | private string _workspaceName = $"IntTest_{Guid.NewGuid()}";
14 | private IServicesMgr _servicesManager;
15 | private IHelper _testHelper;
16 |
17 |
18 | [OneTimeSetUp]
19 | public void SetUp()
20 | {
21 | Dictionary configDictionary = new Dictionary();
22 | foreach (string testParameterName in TestContext.Parameters.Names)
23 | {
24 | configDictionary.Add(testParameterName, TestContext.Parameters[testParameterName]);
25 | }
26 | _testHelper = new TestHelper(configDictionary);
27 | _servicesManager = _testHelper.GetServicesManager();
28 | _workspaceId = Helpers.WorkspaceHelpers.WorkspaceHelpers.CreateAsync(_servicesManager, _workspaceName, SharedTestHelpers.ConfigurationHelper.TEST_WORKSPACE_TEMPLATE_NAME).ConfigureAwait(false).GetAwaiter().GetResult();
29 | }
30 |
31 | [OneTimeTearDown]
32 | public void Teardown()
33 | {
34 | Helpers.WorkspaceHelpers.WorkspaceHelpers.Delete(_servicesManager, _workspaceId);
35 | _testHelper = null;
36 | _servicesManager = null;
37 | }
38 |
39 | [Test]
40 | public void GetWorkspaceTest()
41 | {
42 | var workspaceName = Helpers.WorkspaceHelpers.WorkspaceHelpers.GetWorkspaceName(_servicesManager, _workspaceId);
43 |
44 | Assert.AreEqual(_workspaceName, workspaceName);
45 | }
46 |
47 | [Test]
48 | public void GetWorkspaceTest_Failure()
49 | {
50 | Assert.Throws(() => Helpers.WorkspaceHelpers.WorkspaceHelpers.GetWorkspaceName(_servicesManager, 0));
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/cmmap000.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/cmmap000.bin
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/oilink.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/oilink.exe
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/oilink.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/oilink.jar
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccca-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccca-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccch-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccch-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccda-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccda-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccex-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccex-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccfa-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccfa-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccfi-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccfi-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccfmt-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccfmt-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccfnt-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccfnt-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccfut-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccfut-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccind-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccind-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/scclo-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/scclo-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccut-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/sccut-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/wvcore-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/oi/unmanaged/wvcore-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.NUnit.Integration/test.runsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.31025.194
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Relativity.Test.Helpers", "Relativity.Test.Helpers\Relativity.Test.Helpers.csproj", "{500FCC47-7792-47E0-8308-FF7632C65CC9}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Relativity.Test.Helpers.Example.NUnit", "Relativity.Test.Helpers.Example.NUnit\Relativity.Test.Helpers.Example.NUnit.csproj", "{AAA809DA-EA6F-474C-B9C0-D2B6217A5702}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Relativity.Tests.Helpers.Tests.Unit", "Relativity.Tests.Helpers.Tests.Unit\Relativity.Tests.Helpers.Tests.Unit.csproj", "{CB3D61D1-8E16-48F6-8CB9-1D2A71D339FA}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Relativity.Test.Helpers.NUnit.Integration", "Relativity.Test.Helpers.NUnit.Integration\Relativity.Test.Helpers.NUnit.Integration.csproj", "{D1830FE3-416F-4368-BC9C-B230FEAE9172}"
13 | EndProject
14 | Global
15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 | Debug|Any CPU = Debug|Any CPU
17 | Debug|x64 = Debug|x64
18 | Release|Any CPU = Release|Any CPU
19 | Release|x64 = Release|x64
20 | EndGlobalSection
21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
22 | {500FCC47-7792-47E0-8308-FF7632C65CC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {500FCC47-7792-47E0-8308-FF7632C65CC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {500FCC47-7792-47E0-8308-FF7632C65CC9}.Debug|x64.ActiveCfg = Debug|x64
25 | {500FCC47-7792-47E0-8308-FF7632C65CC9}.Debug|x64.Build.0 = Debug|x64
26 | {500FCC47-7792-47E0-8308-FF7632C65CC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
27 | {500FCC47-7792-47E0-8308-FF7632C65CC9}.Release|Any CPU.Build.0 = Release|Any CPU
28 | {500FCC47-7792-47E0-8308-FF7632C65CC9}.Release|x64.ActiveCfg = Release|x64
29 | {500FCC47-7792-47E0-8308-FF7632C65CC9}.Release|x64.Build.0 = Release|x64
30 | {AAA809DA-EA6F-474C-B9C0-D2B6217A5702}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31 | {AAA809DA-EA6F-474C-B9C0-D2B6217A5702}.Debug|Any CPU.Build.0 = Debug|Any CPU
32 | {AAA809DA-EA6F-474C-B9C0-D2B6217A5702}.Debug|x64.ActiveCfg = Debug|Any CPU
33 | {AAA809DA-EA6F-474C-B9C0-D2B6217A5702}.Debug|x64.Build.0 = Debug|Any CPU
34 | {AAA809DA-EA6F-474C-B9C0-D2B6217A5702}.Release|Any CPU.ActiveCfg = Release|Any CPU
35 | {AAA809DA-EA6F-474C-B9C0-D2B6217A5702}.Release|Any CPU.Build.0 = Release|Any CPU
36 | {AAA809DA-EA6F-474C-B9C0-D2B6217A5702}.Release|x64.ActiveCfg = Release|Any CPU
37 | {AAA809DA-EA6F-474C-B9C0-D2B6217A5702}.Release|x64.Build.0 = Release|Any CPU
38 | {CB3D61D1-8E16-48F6-8CB9-1D2A71D339FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39 | {CB3D61D1-8E16-48F6-8CB9-1D2A71D339FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
40 | {CB3D61D1-8E16-48F6-8CB9-1D2A71D339FA}.Debug|x64.ActiveCfg = Debug|Any CPU
41 | {CB3D61D1-8E16-48F6-8CB9-1D2A71D339FA}.Debug|x64.Build.0 = Debug|Any CPU
42 | {CB3D61D1-8E16-48F6-8CB9-1D2A71D339FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
43 | {CB3D61D1-8E16-48F6-8CB9-1D2A71D339FA}.Release|Any CPU.Build.0 = Release|Any CPU
44 | {CB3D61D1-8E16-48F6-8CB9-1D2A71D339FA}.Release|x64.ActiveCfg = Release|Any CPU
45 | {CB3D61D1-8E16-48F6-8CB9-1D2A71D339FA}.Release|x64.Build.0 = Release|Any CPU
46 | {D1830FE3-416F-4368-BC9C-B230FEAE9172}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47 | {D1830FE3-416F-4368-BC9C-B230FEAE9172}.Debug|Any CPU.Build.0 = Debug|Any CPU
48 | {D1830FE3-416F-4368-BC9C-B230FEAE9172}.Debug|x64.ActiveCfg = Debug|Any CPU
49 | {D1830FE3-416F-4368-BC9C-B230FEAE9172}.Debug|x64.Build.0 = Debug|Any CPU
50 | {D1830FE3-416F-4368-BC9C-B230FEAE9172}.Release|Any CPU.ActiveCfg = Release|Any CPU
51 | {D1830FE3-416F-4368-BC9C-B230FEAE9172}.Release|Any CPU.Build.0 = Release|Any CPU
52 | {D1830FE3-416F-4368-BC9C-B230FEAE9172}.Release|x64.ActiveCfg = Release|Any CPU
53 | {D1830FE3-416F-4368-BC9C-B230FEAE9172}.Release|x64.Build.0 = Release|Any CPU
54 | EndGlobalSection
55 | GlobalSection(SolutionProperties) = preSolution
56 | HideSolutionNode = FALSE
57 | EndGlobalSection
58 | GlobalSection(ExtensibilityGlobals) = postSolution
59 | SolutionGuid = {B19ECB98-3620-4487-A036-CE7938D94C1A}
60 | EndGlobalSection
61 | EndGlobal
62 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers.sln.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
3 | True
4 | True
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/ArtifactHelpers/ChoiceHelper.cs:
--------------------------------------------------------------------------------
1 | using Relativity.API;
2 | using Relativity.Services;
3 | using Relativity.Services.Objects;
4 | using Relativity.Services.Objects.DataContracts;
5 | using Relativity.Test.Helpers.Exceptions;
6 | using System;
7 | using System.Collections.Generic;
8 | using System.Linq;
9 | using System.Threading.Tasks;
10 |
11 | namespace Relativity.Test.Helpers.ArtifactHelpers
12 | {
13 | public static class ChoiceHelper
14 | {
15 | public static async Task GetChoiceId(IServicesMgr servicesMgr, string choiceName)
16 | {
17 | try
18 | {
19 | using (IObjectManager objectManager = servicesMgr.CreateProxy(ExecutionIdentity.CurrentUser))
20 | {
21 | QueryRequest queryRequest = new QueryRequest()
22 | {
23 | ObjectType = new ObjectTypeRef { ArtifactTypeID = Constants.ArtifactTypeIds.Choice },
24 | Condition = new TextCondition("Name", TextConditionEnum.EqualTo, choiceName).ToQueryString(),
25 | Fields = new List()
26 | {
27 | new FieldRef { Name = "Name" }
28 | },
29 | };
30 | QueryResult result = await objectManager.QueryAsync(-1, queryRequest, 1, 10);
31 |
32 | return result.Objects.First().ArtifactID;
33 | }
34 | }
35 | catch (Exception ex)
36 | {
37 | string errorMessage = $"Could not find Choice in {nameof(GetChoiceId)} for {nameof(choiceName)} of {choiceName} - {ex.Message}";
38 | Console.WriteLine(errorMessage);
39 | throw new TestHelpersException(errorMessage);
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/ArtifactHelpers/ClientHelper.cs:
--------------------------------------------------------------------------------
1 | using Relativity.API;
2 | using Relativity.Services;
3 | using Relativity.Services.Choice;
4 | using Relativity.Services.Client;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Threading.Tasks;
9 |
10 | namespace Relativity.Test.Helpers.ArtifactHelpers
11 | {
12 | public class ClientHelper
13 | {
14 | public static int CreateClient(IServicesMgr servicesMgr, string name)
15 | {
16 | try
17 | {
18 | using (IClientManager proxy = servicesMgr.CreateProxy(ExecutionIdentity.CurrentUser))
19 | {
20 | List choiceRefs = proxy.GetStatusChoicesForClientAsync().ConfigureAwait(false).GetAwaiter().GetResult();
21 | ChoiceRef statusRef = choiceRefs.Find(x => x.Name == "Active");
22 |
23 | var newClient = new Services.Client.Client
24 | {
25 | Name = name,
26 | Number = Guid.NewGuid().ToString(),
27 | Status = statusRef,
28 | Keywords = "Test Client",
29 | Notes = "Created with Relativity Test Helpers."
30 | };
31 |
32 | var clientArtifactId = proxy.CreateSingleAsync(newClient).ConfigureAwait(false).GetAwaiter().GetResult();
33 |
34 | return clientArtifactId;
35 | }
36 | }
37 | catch (Exception ex)
38 | {
39 | throw new Exception("Unable to create client.", ex);
40 | }
41 | }
42 |
43 | public static void DeleteClient(IServicesMgr servicesMgr, int artifactId)
44 | {
45 | try
46 | {
47 | using (IClientManager proxy = servicesMgr.CreateProxy(ExecutionIdentity.CurrentUser))
48 | {
49 | proxy.DeleteSingleAsync(artifactId).ConfigureAwait(false).GetAwaiter().GetResult();
50 | }
51 | }
52 | catch (Exception ex)
53 | {
54 | throw new Exception("Unable to delete client.", ex);
55 | }
56 | }
57 |
58 | public static async Task GetClientId(IServicesMgr servicesMgr, string clientName)
59 | {
60 | int clientId;
61 |
62 | using (IClientManager clientManager = servicesMgr.CreateProxy(ExecutionIdentity.CurrentUser))
63 | {
64 | Services.Query query = new Services.Query()
65 | {
66 | Condition = new TextCondition("Name", TextConditionEnum.EqualTo, clientName).ToQueryString()
67 | };
68 | ClientQueryResultSet result = await clientManager.QueryAsync(query);
69 | clientId = result.Results.First().Artifact.ArtifactID;
70 | }
71 |
72 | return clientId;
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/ArtifactHelpers/DocumentHelper.cs:
--------------------------------------------------------------------------------
1 | using Relativity.API;
2 | using Relativity.Services.Objects;
3 | using Relativity.Services.Objects.DataContracts;
4 | using Relativity.Test.Helpers.ArtifactHelpers.Interfaces;
5 | using Relativity.Test.Helpers.ServiceFactory.Extentions;
6 | using Relativity.Test.Helpers.SharedTestHelpers;
7 | using System;
8 | using System.Collections.Generic;
9 | using System.Linq;
10 |
11 | namespace Relativity.Test.Helpers.ArtifactHelpers
12 | {
13 | ///
14 | ///
15 | /// Helpers to interact with Documents in Relativity
16 | ///
17 | ///
18 |
19 | public class DocumentHelper : IDocumentHelper
20 | {
21 | #region Public Methods
22 |
23 | public static string GetDocumentIdentifierFieldName(IServicesMgr svcMgr, int workspaceId, int fieldArtifactTypeId)
24 | {
25 | try
26 | {
27 | string fieldName = null;
28 | using (IObjectManager objectManager = svcMgr.GetProxy(ConfigurationHelper.ADMIN_USERNAME, ConfigurationHelper.DEFAULT_PASSWORD))
29 | {
30 | QueryRequest queryRequest = new QueryRequest()
31 | {
32 | ObjectType = new ObjectTypeRef()
33 | {
34 | ArtifactTypeID = fieldArtifactTypeId
35 | },
36 | Fields = new List()
37 | {
38 | new FieldRef {Name = "*"}
39 | },
40 | Condition = $"'Object Type' == 'Document'"
41 | };
42 |
43 | QueryResult queryResult = objectManager.QueryAsync(workspaceId, queryRequest, 0, 100).ConfigureAwait(false)
44 | .GetAwaiter().GetResult();
45 | if (queryResult.TotalCount == 0)
46 | {
47 | throw new Exception("Query for Document Fields returned no results");
48 | }
49 |
50 | foreach (RelativityObject obj in queryResult.Objects)
51 | {
52 | IEnumerable isIdentifierfieldValuePair = obj.FieldValues.Where(x => x.Field.Name == "Is Identifier");
53 | IEnumerable nameFieldValuePair = obj.FieldValues.Where(x => x.Field.Name == "Name");
54 | bool isIdentifierFieldValue = (bool)isIdentifierfieldValuePair.First().Value;
55 | if (isIdentifierFieldValue)
56 | {
57 | fieldName = nameFieldValuePair.First().Value.ToString();
58 | break;
59 | }
60 | }
61 |
62 | return fieldName;
63 | }
64 | }
65 | catch (Exception ex)
66 | {
67 | throw new Exception("Failed to Query for Document Fields", ex);
68 | }
69 | }
70 |
71 | #endregion
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/ArtifactHelpers/FoldersHelper.cs:
--------------------------------------------------------------------------------
1 | using Relativity.Services;
2 | using Relativity.Services.Folder;
3 | using Relativity.Test.Helpers.ArtifactHelpers.Interfaces;
4 | using Relativity.Test.Helpers.Exceptions;
5 | using Relativity.Test.Helpers.ServiceFactory.Extentions;
6 | using Relativity.Test.Helpers.SharedTestHelpers;
7 | using System;
8 | using System.Linq;
9 | using IServicesMgr = Relativity.API.IServicesMgr;
10 |
11 | namespace Relativity.Test.Helpers.ArtifactHelpers
12 | {
13 |
14 | ///
15 | ///
16 | /// Helpers to interact with Folders in Relativity
17 | ///
18 | ///
19 | ///
20 | public class FoldersHelper : IFoldersHelper
21 | {
22 | private static bool? _keplerCompatible;
23 |
24 | #region Public Methods
25 |
26 | public static string GetFolderName(IServicesMgr svcMgr, int folderArtifactId, int workspaceId)
27 | {
28 | Query query = new Services.Query();
29 | query.Condition = $"'ArtifactID' == {folderArtifactId}";
30 | using (IFolderManager folderManager =
31 | svcMgr.GetProxy(ConfigurationHelper.ADMIN_USERNAME, ConfigurationHelper.DEFAULT_PASSWORD))
32 | {
33 | FolderResultSet result = folderManager.QueryAsync(workspaceId, query, 100).ConfigureAwait(false).GetAwaiter().GetResult();
34 | if (!result.Success)
35 | {
36 | throw new Exception("Error Querying for Folder");
37 | }
38 |
39 | string folderName = result.Results.First().Artifact.Name;
40 | return folderName;
41 | }
42 | }
43 |
44 | public static int GetRootFolderArtifactID(int workspaceID, IServicesMgr svgMgr, string userName, string password)
45 | {
46 | try
47 | {
48 | using (IFolderManager folderManager = svgMgr.GetProxy(userName, password))
49 | {
50 | Services.Query query = new Services.Query();
51 | int length = 5;
52 | Condition queryCondition = new TextCondition("Name", Services.TextConditionEnum.EqualTo, WorkspaceHelpers.WorkspaceHelpers.GetWorkspaceName(svgMgr, workspaceID));
53 | string queryString = queryCondition.ToQueryString();
54 | query.Condition = queryString;
55 |
56 | FolderResultSet result = folderManager.QueryAsync(workspaceID, query, length).ConfigureAwait(false).GetAwaiter().GetResult();
57 |
58 | if (!result.Success)
59 | {
60 | throw new TestHelpersException("Folder was not found");
61 | }
62 | else if (result.TotalCount == 0)
63 | {
64 | throw new TestHelpersException("folder count was 0, so the folder was not found");
65 | }
66 | return result.Results.FirstOrDefault().Artifact.ArtifactID;
67 | }
68 | }
69 | catch (Exception exception)
70 | {
71 | throw new TestHelpersException($"Error Getting Root Folder ArtifactID [{nameof(workspaceID)}:{workspaceID}]", exception);
72 | }
73 | }
74 |
75 | public static int CreateFolder(IServicesMgr svcMgr, int workspaceId, string folderName)
76 | {
77 | try
78 | {
79 | var folder = new Relativity.Services.Folder.Folder
80 | {
81 | Name = folderName
82 | };
83 |
84 | int folderId;
85 | using (IFolderManager folderManager = svcMgr.GetProxy(ConfigurationHelper.ADMIN_USERNAME, ConfigurationHelper.DEFAULT_PASSWORD))
86 | {
87 | folderId = folderManager.CreateSingleAsync(workspaceId, folder).ConfigureAwait(false).GetAwaiter().GetResult();
88 | }
89 |
90 | return folderId;
91 | }
92 | catch (Exception ex)
93 | {
94 | throw new TestHelpersException($"Error creating folder [{nameof(folderName)}:{folderName}]", ex);
95 | }
96 |
97 | }
98 |
99 | #endregion
100 |
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/ArtifactHelpers/Interfaces/IDocumentHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Relativity.Test.Helpers.ArtifactHelpers.Interfaces
8 | {
9 | public interface IDocumentHelper
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/ArtifactHelpers/Interfaces/IFieldsHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Relativity.Test.Helpers.ArtifactHelpers.Interfaces
8 | {
9 | public interface IFieldsHelper
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/ArtifactHelpers/Interfaces/IFoldersHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Relativity.API;
7 |
8 | namespace Relativity.Test.Helpers.ArtifactHelpers.Interfaces
9 | {
10 | public interface IFoldersHelper
11 | {
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Authentication/AuthenticationManager.cs:
--------------------------------------------------------------------------------
1 | using Relativity.API;
2 | using System;
3 |
4 | namespace Relativity.Test.Helpers.Authentication
5 | {
6 | public class AuthenticationManager : IAuthenticationMgr
7 | {
8 | public IUserInfo UserInfo { get; set; }
9 | public string AuthToken { get; set; }
10 |
11 | public AuthenticationManager(IUserInfo userinfo, string authToken = null)
12 | {
13 | if (userinfo == null)
14 | {
15 | throw new Exception("UserInfo cannot be null");
16 | }
17 | UserInfo = userinfo;
18 | AuthToken = authToken;
19 | }
20 |
21 | public string GetAuthenticationToken()
22 | {
23 | return AuthToken;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Authentication/UserInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Relativity.API;
7 |
8 | namespace Relativity.Test.Helpers.Authentication
9 | {
10 | public class UserInfo : IUserInfo
11 | {
12 | public int WorkspaceUserArtifactID { get; set; }
13 |
14 | public int ArtifactID { get; set; }
15 |
16 | public string FirstName { get; set; }
17 |
18 | public string LastName { get; set; }
19 |
20 | public string FullName { get; set; }
21 |
22 | public string EmailAddress { get; set; }
23 |
24 | public int AuditWorkspaceUserArtifactID { get; set; }
25 |
26 | public int AuditArtifactID { get; set; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Constants.cs:
--------------------------------------------------------------------------------
1 | namespace Relativity.Test.Helpers
2 | {
3 | public class Constants
4 | {
5 | public class ArtifactTypeIds
6 | {
7 | public const int System = 1;
8 | public const int User = 2;
9 | public const int Group = 3;
10 | public const int View = 4;
11 | public const int Client = 5;
12 | public const int Matter = 6;
13 | public const int Choice = 7;
14 | public const int Code = 7;
15 | public const int Workspace = 8;
16 | public const int Folder = 9;
17 | public const int Document = 10;
18 | public const int Field = 14;
19 | public const int Search = 15;
20 | public const int Layout = 16;
21 | public const int Production = 17;
22 | public const int Error = 18;
23 | public const int Report = 19;
24 | public const int Agent = 20;
25 | public const int MarkupSet = 22;
26 | public const int Tab = 23;
27 | public const int BatchSet = 24;
28 | public const int ObjectType = 25;
29 | public const int SearchFolder = 26;
30 | public const int Batch = 27;
31 | public const int RelativityScript = 28;
32 | public const int SearchIndex = 29;
33 | public const int ResourceFile = 30;
34 | public const int ResourcePool = 31;
35 | public const int ResourceServer = 32;
36 | public const int ObjectRule = 33;
37 | public const int LibraryApplication = 34;
38 | public const int AgentType = 35;
39 | public const int CaseApplication = 36;
40 | public const int ApplicationInstall = 37;
41 | public const int ApplicationInstallResult = 38;
42 | public const int License = 39;
43 | public const int InstallEventHandler = 40;
44 | public const int MassOperation = 41;
45 | public const int InstanceSetting = 42;
46 | public const int Credential = 43;
47 | }
48 |
49 | public class TestHelperTemporaryValues
50 | {
51 | public class UserHelperTemporaryValues
52 | {
53 | public const string FirstName = "Temp User";
54 | public const string Client = "Relativity Template";
55 | public const string UserType = "Internal";
56 | public const string EmailPrefix = "tempuser.";
57 | public const string EmailSuffix = "@test.com";
58 | public const string AuthProviderType = "Password";
59 | }
60 | }
61 |
62 | public class Kepler
63 | {
64 | public class RouteNames
65 | {
66 | public const string GetGuidAsync = "GetGuidAsync";
67 | public const string GetFieldArtifactIdAsync = "GetFieldArtifactIdAsync";
68 | public const string GetFieldCountAsync = "GetFieldCountAsync";
69 | public const string GetFolderNameAsync = "GetFolderNameAsync";
70 | public const string GetDocumentIdentifierFieldColumnNameAsync = "GetDocumentIdentifierFieldColumnNameAsync";
71 | public const string GetDocumentIdentifierFieldNameAsync = "GetDocumentIdentifierFieldNameAsync";
72 | }
73 |
74 | public class KeplerTestRap
75 | {
76 | public const string KEPLER_TEST_APP_GUID = "151e017c-fcaa-49e6-ae20-3c2b5e721711";
77 | }
78 |
79 | public const string SERVICES_DLL_NAME = "TestHelpersKepler.Services.dll";
80 | public const string INTERFACES_DLL_NAME = "TestHelpersKepler.Interfaces.dll";
81 | public const string MINIMUM_KEPLER_COMPATIBLE_VERSION = "10.3.191.8";
82 | public const int TWENTY_SECONDS = 20000;
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/EnvironmentContext.cs:
--------------------------------------------------------------------------------
1 | namespace Relativity.Test.Helpers
2 | {
3 | public class EnvironmentContext
4 | {
5 | public string Username { get; set; }
6 | public string Password { get; set; }
7 |
8 | public string AdminUsername { get; set; }
9 | public string AdminPassword { get; set; }
10 |
11 | public string SqlServerUrl { get; set; }
12 | public string SqlUserName { get; set; }
13 | public string SqlPassword { get; set; }
14 | public string ServerBindingType { get; set; }
15 | public string ServerAddress { get; set; }
16 |
17 | public string RestServiceUrl
18 | {
19 | get
20 | {
21 | return $"{ServerBindingType}://{ServerAddress}/relativity.rest";
22 | }
23 | }
24 | public string ServicesUrl
25 | {
26 | get
27 | {
28 | return $"{ServerBindingType}://{ServerAddress}/relativity.services";
29 | }
30 | }
31 |
32 | public string KeplerUrl
33 | {
34 | get
35 | {
36 | return $"{RestServiceUrl}/api";
37 | }
38 | }
39 |
40 | public static EnvironmentContext FromConfig()
41 | {
42 | return new EnvironmentContext
43 | {
44 | Username = SharedTestHelpers.ConfigurationHelper.ADMIN_USERNAME,
45 | Password = SharedTestHelpers.ConfigurationHelper.DEFAULT_PASSWORD,
46 | SqlServerUrl = SharedTestHelpers.ConfigurationHelper.SQL_SERVER_ADDRESS,
47 | SqlUserName = SharedTestHelpers.ConfigurationHelper.SQL_USER_NAME,
48 | SqlPassword = SharedTestHelpers.ConfigurationHelper.SQL_PASSWORD,
49 | ServerBindingType = SharedTestHelpers.ConfigurationHelper.SERVER_BINDING_TYPE,
50 | ServerAddress = SharedTestHelpers.ConfigurationHelper.RELATIVITY_INSTANCE_ADDRESS
51 | };
52 | }
53 | }
54 |
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Exceptions/IntegrationTestException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Relativity.Test.Helpers.Exceptions
8 | {
9 | public class IntegrationTestException : System.Exception
10 | {
11 |
12 | public IntegrationTestException()
13 | {
14 | }
15 |
16 | public IntegrationTestException(string message)
17 | : base(message)
18 | {
19 | }
20 |
21 | public IntegrationTestException(string message, System.Exception inner)
22 | : base(message, inner)
23 | {
24 | }
25 |
26 | // A constructor is needed for serialization when an
27 | // exception propagates from a remoting server to the client.
28 | protected IntegrationTestException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
29 | {
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Exceptions/TestHelpersApplicationInstallException.cs:
--------------------------------------------------------------------------------
1 | namespace Relativity.Test.Helpers.Exceptions
2 | {
3 | public class TestHelpersApplicationInstallException : System.Exception
4 | {
5 | public TestHelpersApplicationInstallException()
6 | {
7 | }
8 |
9 | public TestHelpersApplicationInstallException(string message)
10 | : base(message)
11 | {
12 | }
13 |
14 | public TestHelpersApplicationInstallException(string message, System.Exception inner)
15 | : base(message, inner)
16 | {
17 | }
18 |
19 | // A constructor is needed for serialization when an
20 | // exception propagates from a remoting server to the client.
21 | protected TestHelpersApplicationInstallException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
22 | {
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Exceptions/TestHelpersException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Relativity.Test.Helpers.Exceptions
8 | {
9 | public class TestHelpersException : System.Exception
10 | {
11 | public TestHelpersException()
12 | {
13 | }
14 |
15 | public TestHelpersException(string message)
16 | : base(message)
17 | {
18 | }
19 |
20 | public TestHelpersException(string message, System.Exception inner)
21 | : base(message, inner)
22 | {
23 | }
24 |
25 | // A constructor is needed for serialization when an
26 | // exception propagates from a remoting server to the client.
27 | protected TestHelpersException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
28 | {
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Exceptions/TestHelpersOAuth2Exception.cs:
--------------------------------------------------------------------------------
1 | namespace Relativity.Test.Helpers.Exceptions
2 | {
3 | public class TestHelpersOAuth2Exception : System.Exception
4 | {
5 | public TestHelpersOAuth2Exception()
6 | {
7 | }
8 |
9 | public TestHelpersOAuth2Exception(string message)
10 | : base(message)
11 | {
12 | }
13 |
14 | public TestHelpersOAuth2Exception(string message, System.Exception inner)
15 | : base(message, inner)
16 | {
17 | }
18 |
19 | // A constructor is needed for serialization when an
20 | // exception propagates from a remoting server to the client.
21 | protected TestHelpersOAuth2Exception(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
22 | {
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/FreeImage.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/FreeImage.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/HelperClass/TestAgentHelper.cs:
--------------------------------------------------------------------------------
1 | using Relativity.API;
2 | using System;
3 |
4 | namespace Relativity.Test.Helpers.HelperClasses
5 | {
6 | public class TestAgentHelper : IAgentHelper
7 | {
8 | private IHelper _helper;
9 | private int WorkspaceID { get; set; }
10 | public string AdminUsername { get; set; }
11 | public string AdminPassword { get; set; }
12 | private string SQLServerAddress { get; set; }
13 | private string SQLUserName { get; set; }
14 | private string SQLPassword { get; set; }
15 | private string SolutionSnapshotRAPUrl { get; set; }
16 | private string ServerHostName { get; set; }
17 | private string ServerHostBinding { get; set; }
18 | private string RAPFilesDirectory { get; set; }
19 |
20 | public TestAgentHelper()
21 | {
22 | this._helper = new TestHelper(AdminUsername, AdminPassword);
23 | }
24 |
25 | void IDisposable.Dispose()
26 | {
27 | this._helper.Dispose();
28 | }
29 |
30 | IAuthenticationMgr IAgentHelper.GetAuthenticationManager()
31 | {
32 | throw new NotImplementedException();
33 | }
34 |
35 | IDBContext IHelper.GetDBContext(int caseID)
36 | {
37 | return this._helper.GetDBContext(caseID);
38 | }
39 |
40 | Guid IHelper.GetGuid(int workspaceID, int artifactID)
41 | {
42 | return this._helper.GetGuid(workspaceID, artifactID);
43 | }
44 |
45 | IInstanceSettingsBundle IHelper.GetInstanceSettingBundle()
46 | {
47 | return this._helper.GetInstanceSettingBundle();
48 | }
49 |
50 | ILogFactory IHelper.GetLoggerFactory()
51 | {
52 | return this._helper.GetLoggerFactory();
53 | }
54 |
55 | string IHelper.GetSchemalessResourceDataBasePrepend(IDBContext context)
56 | {
57 | return this._helper.GetSchemalessResourceDataBasePrepend(context);
58 | }
59 |
60 | ISecretStore IHelper.GetSecretStore()
61 | {
62 | return this._helper.GetSecretStore();
63 | }
64 |
65 | IServicesMgr IHelper.GetServicesManager()
66 | {
67 | return this._helper.GetServicesManager();
68 | }
69 | /* Needed for Relativity DLLS 10.* and above
70 | IStringSanitizer IHelper.GetStringSanitizer(int workspaceID)
71 | {
72 | return this._helper.GetStringSanitizer(workspaceID);
73 | } */
74 |
75 | IUrlHelper IHelper.GetUrlHelper()
76 | {
77 | return this._helper.GetUrlHelper();
78 | }
79 |
80 | string IHelper.ResourceDBPrepend()
81 | {
82 | return this._helper.ResourceDBPrepend();
83 | }
84 |
85 | string IHelper.ResourceDBPrepend(IDBContext context)
86 | {
87 | return this._helper.ResourceDBPrepend(context);
88 | }
89 |
90 | public IStringSanitizer GetStringSanitizer(int workspaceID)
91 | {
92 | throw new NotImplementedException();
93 | }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/HelperClass/TestEHHelper.cs:
--------------------------------------------------------------------------------
1 | using Relativity.API;
2 | using Relativity.Test.Helpers.Authentication;
3 | using Relativity.Test.Helpers.UserHelpers;
4 | using System;
5 |
6 | namespace Relativity.Test.Helpers.HelperClasses
7 | {
8 | public class TestEHHelper : IEHHelper
9 | {
10 |
11 | //private readonly ConfigurationModel _configs;
12 | public int WorkspaceID { get; set; }
13 | public string AdminUsername { get; set; }
14 | public string AdminPassword { get; set; }
15 | private string SQLServerAddress { get; set; }
16 | private string SQLUserName { get; set; }
17 | private string SQLPassword { get; set; }
18 | private string SolutionSnapshotRAPUrl { get; set; }
19 | private string ServerHostName { get; set; }
20 | private string ServerHostBinding { get; set; }
21 | private string RAPFilesDirectory { get; set; }
22 | private int UserId { get; set; }
23 |
24 | private IHelper _helper;
25 |
26 | public TestEHHelper(string username, string password)
27 | {
28 | AdminUsername = username;
29 | AdminPassword = password;
30 | _helper = new TestHelper(username, password);
31 | }
32 |
33 | public TestEHHelper(string configSectionName)
34 | {
35 | _helper = new TestHelper(configSectionName);
36 | }
37 |
38 | public int GetActiveCaseID()
39 | {
40 | return WorkspaceID;
41 | }
42 |
43 | public IAuthenticationMgr GetAuthenticationManager()
44 | {
45 | if (UserId <= 0)
46 | {
47 | try
48 | {
49 | UserId = UserHelper.GetUserId(_helper.GetServicesManager(), SharedTestHelpers.ConfigurationHelper.ADMIN_USERNAME).ConfigureAwait(false).GetAwaiter().GetResult();
50 | }
51 | catch (Exception ex)
52 | {
53 | throw ex;
54 | }
55 | }
56 |
57 | UserInfo userInfo = new UserInfo
58 | {
59 | FirstName = SharedTestHelpers.ConfigurationHelper.ADMIN_USERNAME,
60 | ArtifactID = UserId,
61 | EmailAddress = SharedTestHelpers.ConfigurationHelper.ADMIN_USERNAME
62 | };
63 |
64 | AuthenticationManager authManager = new AuthenticationManager(userInfo);
65 |
66 | return authManager;
67 | }
68 |
69 | public IDBContext GetDBContext(int caseID)
70 | {
71 | return _helper.GetDBContext(caseID);
72 | }
73 |
74 | public Guid GetGuid(int workspaceID, int artifactID)
75 | {
76 | return _helper.GetGuid(workspaceID, artifactID);
77 | }
78 |
79 | public IInstanceSettingsBundle GetInstanceSettingBundle()
80 | {
81 | return _helper.GetInstanceSettingBundle();
82 | }
83 |
84 | public ILogFactory GetLoggerFactory()
85 | {
86 | return _helper.GetLoggerFactory();
87 | }
88 |
89 | public string GetSchemalessResourceDataBasePrepend(IDBContext context)
90 | {
91 | return _helper.GetSchemalessResourceDataBasePrepend(context);
92 | }
93 |
94 | public ISecretStore GetSecretStore()
95 | {
96 | return _helper.GetSecretStore();
97 | }
98 |
99 | public IServicesMgr GetServicesManager()
100 | {
101 | return _helper.GetServicesManager();
102 | }
103 |
104 | public IUrlHelper GetUrlHelper()
105 | {
106 | return _helper.GetUrlHelper();
107 | }
108 |
109 | public string ResourceDBPrepend()
110 | {
111 | return _helper.ResourceDBPrepend();
112 | }
113 |
114 | public string ResourceDBPrepend(IDBContext context)
115 | {
116 | return _helper.ResourceDBPrepend(context);
117 | }
118 |
119 | #region IDisposable Support
120 | private bool disposedValue = false; // To detect redundant calls
121 |
122 | protected virtual void Dispose(bool disposing)
123 | {
124 | if (!disposedValue)
125 | {
126 | if (disposing)
127 | {
128 | // TODO: dispose managed state (managed objects).
129 | _helper.Dispose();
130 | }
131 |
132 | // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
133 | // TODO: set large fields to null.
134 | _helper = null;
135 |
136 | disposedValue = true;
137 | }
138 | }
139 |
140 | // TODO: override a finalizer only if Dispose(bool disposing) above has code to free unmanaged resources.
141 | // ~TestEHHelper() {
142 | // // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
143 | // Dispose(false);
144 | // }
145 |
146 | // This code added to correctly implement the disposable pattern.
147 | public void Dispose()
148 | {
149 | // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
150 | Dispose(true);
151 | // TODO: uncomment the following line if the finalizer is overridden above.
152 | // GC.SuppressFinalize(this);
153 | }
154 |
155 | public IStringSanitizer GetStringSanitizer(int workspaceID)
156 | {
157 | throw new NotImplementedException();
158 | }
159 | #endregion
160 | }
161 | }
162 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/ImportAPIHelper/Constants.cs:
--------------------------------------------------------------------------------
1 | namespace Relativity.Test.Helpers.ImportAPIHelper
2 | {
3 | internal static class Constants
4 | {
5 | public const string NATIVE_FILE = "Native File";
6 | public const string ENCODING_ISO_8859_1_NAME = "iso-8859-1";
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/ImportAPIHelper/ImportDocument.cs:
--------------------------------------------------------------------------------
1 | namespace Relativity.Test.Helpers.ImportAPIHelper
2 | {
3 | public class ImportDocument
4 | {
5 | public string Name { get; set; }
6 | public string FilePath { get; set; }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/ImportAPIHelper/Request/ImportJobRequest.cs:
--------------------------------------------------------------------------------
1 | using kCura.Relativity.DataReaderClient;
2 | using System;
3 | using System.Text;
4 | using static Relativity.Test.Helpers.ImportAPIHelper.Constants;
5 |
6 | namespace Relativity.Test.Helpers.ImportAPIHelper.Request
7 | {
8 | ///
9 | /// Request for an import job
10 | ///
11 | public class ImportJobRequest
12 | {
13 | ///
14 | /// Target workspace for Import
15 | ///
16 | public int WorkspaceID { get; }
17 | ///
18 | /// Target object type id for import (Defaulted to Document)
19 | ///
20 | public int ArtifactTypeID { get; }
21 | public bool ExtractedTextFieldContainsFilePath { get; set; } = false;
22 | public bool DisableExtractedTextEncodingCheck { get; set; } = true;
23 | public bool DisableExtractedTextFileLocationValidation { get; set; } = true;
24 | public bool DisableNativeLocationValidation { get; set; } = true;
25 | public bool DisableNativeValidation { get; set; } = true;
26 | public NativeFileCopyModeEnum NativeFileCopyMode { get; set; } = NativeFileCopyModeEnum.CopyFiles;
27 | public OverwriteModeEnum OverwriteMode { get; set; } = OverwriteModeEnum.Append;
28 | public Encoding ExtractedTextEncoding { get; set; } = Encoding.GetEncoding(ENCODING_ISO_8859_1_NAME);
29 | public string ParentObjectIdSourceFieldName { get; set; }
30 | ///
31 | /// Constructor with workspace id and object type id
32 | ///
33 | /// target workspace
34 | /// target type
35 | public ImportJobRequest(int workspaceID, int artifactTypeID)
36 | {
37 | if (workspaceID == default(int))
38 | {
39 | throw new ArgumentNullException(nameof(workspaceID));
40 | }
41 | if (artifactTypeID <= default(int))
42 | {
43 | throw new ArgumentNullException(nameof(artifactTypeID));
44 | }
45 | WorkspaceID = workspaceID;
46 | ArtifactTypeID = artifactTypeID;
47 | }
48 | ///
49 | /// Constructor with workspace id
50 | ///
51 | /// target workspace
52 | public ImportJobRequest(int workspaceID) : this(workspaceID, (int)Helpers.Constants.ArtifactTypeIds.Document)
53 | {
54 | }
55 |
56 | public void HydrateImportJob(ImportBulkArtifactJob importJob)
57 | {
58 | importJob.Settings.CaseArtifactId = WorkspaceID;
59 | importJob.Settings.ExtractedTextFieldContainsFilePath = ExtractedTextFieldContainsFilePath;
60 | importJob.Settings.DisableExtractedTextEncodingCheck = DisableExtractedTextEncodingCheck;
61 | importJob.Settings.DisableExtractedTextFileLocationValidation = DisableExtractedTextFileLocationValidation;
62 | importJob.Settings.NativeFilePathSourceFieldName = NATIVE_FILE;
63 | importJob.Settings.DisableNativeLocationValidation = DisableNativeLocationValidation;
64 | importJob.Settings.DisableNativeValidation = DisableNativeValidation;
65 | importJob.Settings.NativeFileCopyMode = NativeFileCopyMode;
66 | importJob.Settings.OverwriteMode = OverwriteMode;
67 | importJob.Settings.ExtractedTextEncoding = ExtractedTextEncoding;
68 | if (!string.IsNullOrEmpty(ParentObjectIdSourceFieldName))
69 | {
70 | importJob.Settings.ParentObjectIdSourceFieldName = ParentObjectIdSourceFieldName;
71 | }
72 |
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Kepler/IApplicationInstallHelper.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Threading.Tasks;
3 |
4 | namespace Relativity.Test.Helpers.Kepler
5 | {
6 | public interface IApplicationInstallHelper
7 | {
8 | ///
9 | /// Installs the application into a workspace. Will install the application into the Library if it does not exist there already
10 | ///
11 | ///
12 | ///
13 | ///
14 | ///
15 | ///
16 | Task InstallApplicationAsync(string applicationName, FileStream fileStream, int workspaceId, bool unlockApps);
17 |
18 | ///
19 | /// Deletes the application from the Library if it exists.
20 | ///
21 | ///
22 | ///
23 | Task DeleteApplicationFromLibraryIfItExistsAsync(string applicationName);
24 |
25 | ///
26 | /// Checks if the application exists in the Library
27 | ///
28 | ///
29 | ///
30 | Task DoesLibraryApplicationExistAsync(string applicationName);
31 |
32 | ///
33 | /// Checks if the application exists in the given workspace
34 | ///
35 | ///
36 | ///
37 | ///
38 | ///
39 | Task DoesWorkspaceApplicationExistAsync(string applicationName, int workspaceId, int workspaceApplicationInstallId);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Kepler/IOAuth2Helper.cs:
--------------------------------------------------------------------------------
1 | using System.Net.Http;
2 | using System.Threading.Tasks;
3 |
4 | namespace Relativity.Test.Helpers.Kepler
5 | {
6 | public interface IOAuth2Helper
7 | {
8 | ///
9 | /// Use this to create an OAuth2 authentication for Relativity, which will allow you to get a Bearer Token and gain access to Relativity
10 | ///
11 | ///
12 | ///
13 | ///
14 | Task CreateOAuth2ClientAsync(string username, string oAuth2Name);
15 |
16 | ///
17 | /// Use this to get the Bearer Token that will give you access Relativity and various endpoints
18 | ///
19 | ///
20 | ///
21 | ///
22 | ///
23 | ///
24 | ///
25 | ///
26 | ///
27 | Task GetBearerTokenAsync(string protocol, string serverAddress, string clientId, string clientSecret, string scope, string grantType, HttpMessageHandler httpMessageHandler);
28 |
29 | ///
30 | /// Use this to cleanup OAuth2 during tests
31 | ///
32 | ///
33 | ///
34 | Task DeleteOAuth2ClientAsync(string clientId);
35 |
36 | ///
37 | /// Returns the OAuth2 Client for a given Name, if it exists
38 | ///
39 | ///
40 | ///
41 | Task ReadOAuth2ClientAsync(string oAuth2Name);
42 |
43 | ///
44 | /// Checks to see if the OAuth2 Client already exists for a given Name
45 | ///
46 | ///
47 | ///
48 | Task DoesOAuth2ClientExistAsync(string oAuth2Name);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2006 Damien Miller (jBCrypt)
2 | Copyright (c) 2013 Ryan D. Emerle (.Net port)
3 |
4 | Permission to use, copy, modify, and distribute this software for any
5 | purpose with or without fee is hereby granted, provided that the above
6 | copyright notice and this permission notice appear in all copies.
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Logging/ConsoleLogger.cs:
--------------------------------------------------------------------------------
1 | using Relativity.API;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Relativity.Test.Helpers.Logging
9 | {
10 | public class ConsoleLogger : IAPILog
11 | {
12 | private string _Context;
13 | public ConsoleLogger()
14 | {
15 |
16 | }
17 | public IAPILog ForContext()
18 | {
19 | this._Context = typeof(T).ToString();
20 | return this;
21 | }
22 |
23 | public IAPILog ForContext(Type source)
24 | {
25 | this._Context = source.ToString();
26 | return this;
27 | }
28 |
29 | public IAPILog ForContext(string propertyName, object value, bool destructureObjects)
30 | {
31 | this._Context = string.Format("Prop: {0}, Val: {1}", propertyName, value.ToString());
32 | return this;
33 | }
34 |
35 | public IDisposable LogContextPushProperty(string propertyName, object obj)
36 | {
37 | throw new NotImplementedException();
38 | }
39 |
40 | public void LogDebug(string messageTemplate, params object[] propertyValues)
41 | {
42 | System.Console.WriteLine(string.Format(messageTemplate, propertyValues));
43 | }
44 |
45 | public void LogDebug(Exception exception, string messageTemplate, params object[] propertyValues)
46 | {
47 | System.Console.WriteLine(string.Format("Exception: {0}, {1}", exception.ToString(), string.Format(messageTemplate, propertyValues)));
48 | }
49 |
50 | public void LogError(string messageTemplate, params object[] propertyValues)
51 | {
52 | this.LogDebug(messageTemplate, propertyValues);
53 | }
54 |
55 | public void LogError(Exception exception, string messageTemplate, params object[] propertyValues)
56 | {
57 | this.LogDebug(exception, messageTemplate, propertyValues);
58 | }
59 |
60 | public void LogFatal(string messageTemplate, params object[] propertyValues)
61 | {
62 | this.LogDebug(messageTemplate, propertyValues);
63 | }
64 |
65 | public void LogFatal(Exception exception, string messageTemplate, params object[] propertyValues)
66 | {
67 | this.LogDebug(exception, messageTemplate, propertyValues);
68 | }
69 |
70 | public void LogInformation(string messageTemplate, params object[] propertyValues)
71 | {
72 | this.LogDebug(messageTemplate, propertyValues);
73 | }
74 |
75 | public void LogInformation(Exception exception, string messageTemplate, params object[] propertyValues)
76 | {
77 | this.LogDebug(exception, messageTemplate, propertyValues);
78 | }
79 |
80 | public void LogVerbose(string messageTemplate, params object[] propertyValues)
81 | {
82 | this.LogDebug(messageTemplate, propertyValues);
83 | }
84 |
85 | public void LogVerbose(Exception exception, string messageTemplate, params object[] propertyValues)
86 | {
87 | this.LogDebug(exception, messageTemplate, propertyValues);
88 | }
89 |
90 | public void LogWarning(string messageTemplate, params object[] propertyValues)
91 | {
92 | this.LogDebug(messageTemplate, propertyValues);
93 | }
94 |
95 | public void LogWarning(Exception exception, string messageTemplate, params object[] propertyValues)
96 | {
97 | this.LogDebug(exception, messageTemplate, propertyValues);
98 | }
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Logging/TestLogFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Relativity.API;
7 |
8 | namespace Relativity.Test.Helpers.Logging
9 | {
10 | public class TestLogFactory : ILogFactory
11 | {
12 |
13 | private IAPILog _Logger;
14 |
15 | public TestLogFactory(IAPILog loggerToUse)
16 | {
17 |
18 | this._Logger = loggerToUse;
19 |
20 | }
21 |
22 | public IAPILog GetLogger()
23 | {
24 | return _Logger;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Mail/GmailInboxModel.cs:
--------------------------------------------------------------------------------
1 | namespace Relativity.Test.Helpers.Mail
2 | {
3 | public class GmailInboxModel : IMailInboxModel
4 | {
5 | public string Id { get; set; }
6 | public string Name { get; set; }
7 | public string UserName { get; set; }
8 | public string Password { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Mail/GmailMailHelper.cs:
--------------------------------------------------------------------------------
1 | using MimeKit;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | namespace Relativity.Test.Helpers.Mail
6 | {
7 | public class GmailMailHelper : IMailHelper
8 | {
9 | private const string Domain = "imap.gmail.com";
10 | private const int Port = 993;
11 | private const bool UseSsl = true;
12 |
13 | public string GmailEmail { get; set; }
14 | public string GmailPassword { get; set; }
15 |
16 | private readonly MailRepository _gmailRepository;
17 |
18 | ///
19 | /// With IMAP setup, you should pass in the email and password to this helper to allow it access to your account.
20 | /// It is recommended to use a separate fake account for testing.
21 | ///
22 | ///
23 | ///
24 | public GmailMailHelper(string gmailEmail, string gmailPassword)
25 | {
26 | GmailEmail = gmailEmail;
27 | GmailPassword = gmailPassword;
28 |
29 | _gmailRepository = new MailRepository(Domain, Port, UseSsl, GmailEmail, GmailPassword);
30 | }
31 |
32 | ///
33 | /// Gmail only has 1 Inbox, and the ID is the userId
34 | ///
35 | ///
36 | public List GetInboxes()
37 | {
38 | List inboxes = new List();
39 | IMailInboxModel inbox = new GmailInboxModel()
40 | {
41 | Id = GmailEmail
42 | };
43 |
44 | inboxes.Add(inbox);
45 |
46 | return inboxes;
47 | }
48 |
49 | ///
50 | /// Returns a small subset of the latest emails (only their ids) in the inbox
51 | ///
52 | /// Inbox is the user's email address
53 | ///
54 | public List GetMessagesInInbox(IMailInboxModel inbox)
55 | {
56 | List messages = new List();
57 |
58 | IEnumerable allEmails = _gmailRepository.GetAllMails();
59 |
60 | foreach (MimeMessage email in allEmails)
61 | {
62 | GmailMessageModel message = new GmailMessageModel()
63 | {
64 | Id = email.MessageId,
65 | InboxId = inbox.Id,
66 | FromEmail = email.From.ToString(),
67 | ToEmail = email.To.ToString(),
68 | Body = (email.HtmlBody ?? email.TextBody)
69 | };
70 | messages.Add(message);
71 | }
72 |
73 | return messages;
74 | }
75 |
76 | ///
77 | /// Returns a message with text inside.
78 | ///
79 | /// Inbox is the user's email address
80 | /// MailTrapMessageModel.id is the source of this
81 | ///
82 | public IMailMessageModel GetMessage(IMailInboxModel inbox, string messageId)
83 | {
84 | IEnumerable allEmails = _gmailRepository.GetAllMails();
85 |
86 | MimeMessage email = allEmails.First(x => x.MessageId.Equals(messageId));
87 |
88 | GmailMessageModel message = new GmailMessageModel()
89 | {
90 | Id = email.MessageId,
91 | InboxId = inbox.Id,
92 | Subject = email.Subject,
93 | FromEmail = email.From.ToString(),
94 | ToEmail = email.To.ToString(),
95 | Body = (email.HtmlBody ?? email.TextBody)
96 | };
97 |
98 | return message;
99 | }
100 |
101 | ///
102 | /// Deletes the selected message
103 | ///
104 | /// /// Inbox is the user's email address
105 | /// MailTrapMessageModel.id is the source of this
106 | ///
107 | public IMailMessageModel DeleteMessage(IMailInboxModel inbox, string messageId)
108 | {
109 | _gmailRepository.DeleteMail(messageId);
110 | GmailMessageModel message = new GmailMessageModel()
111 | {
112 | Id = messageId,
113 | InboxId = inbox.Id
114 | };
115 |
116 | return message;
117 | }
118 | }
119 | }
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Mail/GmailMessageModel.cs:
--------------------------------------------------------------------------------
1 | namespace Relativity.Test.Helpers.Mail
2 | {
3 | public class GmailMessageModel : IMailMessageModel
4 | {
5 | public string Id { get; set; }
6 | public string InboxId { get; set; }
7 | public string Subject { get; set; }
8 | public string FromEmail { get; set; }
9 | public string ToEmail { get; set; }
10 | public string Body { get; set; }
11 |
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Mail/IMailHelper.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Relativity.Test.Helpers.Mail
4 | {
5 | public interface IMailHelper
6 | {
7 | List GetInboxes();
8 | List GetMessagesInInbox(IMailInboxModel inbox);
9 | IMailMessageModel GetMessage(IMailInboxModel inbox, string messageId);
10 | IMailMessageModel DeleteMessage(IMailInboxModel inbox, string messageId);
11 | }
12 | }
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Mail/IMailInboxModel.cs:
--------------------------------------------------------------------------------
1 | namespace Relativity.Test.Helpers.Mail
2 | {
3 | public interface IMailInboxModel
4 | {
5 | string Id { get; set; }
6 | string Name { get; set; }
7 | string UserName { get; set; }
8 | string Password { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Mail/IMailMessageModel.cs:
--------------------------------------------------------------------------------
1 | namespace Relativity.Test.Helpers.Mail
2 | {
3 | public interface IMailMessageModel
4 | {
5 | string Id { get; set; }
6 | string InboxId { get; set; }
7 | string Subject { get; set; }
8 | string FromEmail { get; set; }
9 | string ToEmail { get; set; }
10 | string Body { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Mail/MailRepository.cs:
--------------------------------------------------------------------------------
1 | using MailKit;
2 | using MailKit.Net.Imap;
3 | using MailKit.Search;
4 | using MimeKit;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 |
8 | namespace Relativity.Test.Helpers.Mail
9 | {
10 | ///
11 | /// Gathered some help from https://stackoverflow.com/questions/7056715/reading-emails-from-gmail-in-c-sharp/19570553#19570553
12 | /// Gmail API's were getting cumbersome, this was a cleaner solution
13 | ///
14 | public class MailRepository
15 | {
16 | private readonly string _mailServer, _login, _password;
17 | private readonly int _port;
18 | private readonly bool _ssl;
19 |
20 | public MailRepository(string mailServer, int port, bool ssl, string login, string password)
21 | {
22 | _mailServer = mailServer;
23 | _port = port;
24 | _ssl = ssl;
25 | _login = login;
26 | _password = password;
27 | }
28 |
29 | public IEnumerable GetAllMails()
30 | {
31 | List messages = new List();
32 |
33 | using (ImapClient client = new ImapClient())
34 | {
35 | client.Connect(_mailServer, _port, _ssl);
36 |
37 | // Note: since we don't have an OAuth2 token, disable the XOAUTH2 authentication mechanism.
38 | client.AuthenticationMechanisms.Remove("XOAUTH2");
39 |
40 | client.Authenticate(_login, _password);
41 |
42 | // The Inbox folder is always available on all IMAP servers...
43 | IMailFolder inbox = client.Inbox;
44 | inbox.Open(FolderAccess.ReadOnly);
45 | SearchResults results = inbox.Search(SearchOptions.All, SearchQuery.All);
46 | foreach (UniqueId uniqueId in results.UniqueIds)
47 | {
48 | MimeMessage message = inbox.GetMessage(uniqueId);
49 |
50 | messages.Add(message);
51 | }
52 |
53 | client.Disconnect(true);
54 | }
55 |
56 | return messages.OrderByDescending(x => x.Date);
57 | }
58 |
59 | public void DeleteMail(string messageId)
60 | {
61 | using (ImapClient client = new ImapClient())
62 | {
63 | client.Connect(_mailServer, _port, _ssl);
64 |
65 | // Note: since we don't have an OAuth2 token, disable the XOAUTH2 authentication mechanism.
66 | client.AuthenticationMechanisms.Remove("XOAUTH2");
67 |
68 | client.Authenticate(_login, _password);
69 |
70 | // The Inbox folder is always available on all IMAP servers...
71 | IMailFolder inbox = client.Inbox;
72 | inbox.Open(FolderAccess.ReadWrite);
73 | SearchResults results = inbox.Search(SearchOptions.All, SearchQuery.NotSeen);
74 |
75 | foreach (UniqueId uniqueId in results.UniqueIds)
76 | {
77 | MimeMessage message = inbox.GetMessage(uniqueId);
78 |
79 | if (message.MessageId.Equals(messageId))
80 | {
81 | inbox.AddFlags(uniqueId, MessageFlags.Deleted, true);
82 | break;
83 | }
84 | }
85 |
86 | client.Disconnect(true);
87 | }
88 | }
89 | }
90 |
91 | }
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Mail/MailTrapInboxModel.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Relativity.Test.Helpers.Mail
4 | {
5 | public class MailTrapInboxModel : IMailInboxModel
6 | {
7 | public string Id { get; set; }
8 | [JsonProperty("company_id")]
9 | public int CompanyId { get; set; }
10 | public string Name { get; set; }
11 | public string UserName { get; set; }
12 | public string Password { get; set; }
13 | [JsonProperty("max_size")]
14 | public int MaxSize { get; set; }
15 | public string Status { get; set; }
16 | [JsonProperty("email_username")]
17 | public string EmailUserName { get; set; }
18 | [JsonProperty("email_username_enabled")]
19 | public bool EmailUserNameEnabled { get; set; }
20 | [JsonProperty("sent_messages_count")]
21 | public int SentMessagesCount { get; set; }
22 | [JsonProperty("forwarded_messages_count")]
23 | public int ForwardedMessagesCount { get; set; }
24 | public string Domain { get; set; }
25 | [JsonProperty("pop3_domain")]
26 | public string Pop3Domain { get; set; }
27 | [JsonProperty("email_domain")]
28 | public string EmailDomain { get; set; }
29 | [JsonProperty("emails_count")]
30 | public int EmailsCount { get; set; }
31 | [JsonProperty("emails_unread_count")]
32 | public int EmailsUnreadCount { get; set; }
33 | [JsonProperty("last_message_sent_at_timestamp")]
34 | public int? LastMessageSentAtTimestamp { get; set; }
35 | [JsonProperty("smtp_ports")]
36 | public int[] SmtpPorts { get; set; }
37 | [JsonProperty("pop3_ports")]
38 | public int[] Pop3Ports { get; set; }
39 | [JsonProperty("max_message_size")]
40 | public int MaxMessageSize { get; set; }
41 | [JsonProperty("has_inbox_address")]
42 | public bool HasInboxAddress { get; set; }
43 | }
44 | }
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Mail/MailTrapMessageModel.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System;
3 |
4 | namespace Relativity.Test.Helpers.Mail
5 | {
6 | public class MailTrapMessageModel : IMailMessageModel
7 | {
8 | public string Id { get; set; }
9 | [JsonProperty("inbox_id")]
10 | public string InboxId { get; set; }
11 | public string Body { get; set; }
12 | public string Subject { get; set; }
13 | [JsonProperty("sent_at")]
14 | public DateTime SentAt { get; set; }
15 | [JsonProperty("from_email")]
16 | public string FromEmail { get; set; }
17 | [JsonProperty("from_name")]
18 | public string FromName { get; set; }
19 | [JsonProperty("to_email")]
20 | public string ToEmail { get; set; }
21 | [JsonProperty("to_name")]
22 | public string ToName { get; set; }
23 | [JsonProperty("email_size")]
24 | public int EmailSize { get; set; }
25 | [JsonProperty("is_read")]
26 | public bool IsRead { get; set; }
27 | [JsonProperty("created_at")]
28 | public DateTime CreatedAt { get; set; }
29 | [JsonProperty("updated_at")]
30 | public DateTime UpdatedAt { get; set; }
31 | [JsonProperty("html_body_size")]
32 | public int HtmlBodySize { get; set; }
33 | [JsonProperty("text_body_size")]
34 | public int TextBodySize { get; set; }
35 | [JsonProperty("sent_at_timestamp")]
36 | public int SentAtTimestamp { get; set; }
37 | [JsonProperty("human_size")]
38 | public string HumanSize { get; set; }
39 | [JsonProperty("html_path")]
40 | public string HtmlPath { get; set; }
41 | [JsonProperty("txt_path")]
42 | public string TxtPath { get; set; }
43 | [JsonProperty("raw_path")]
44 | public string RawPath { get; set; }
45 | [JsonProperty("download_path")]
46 | public string DownloadPath { get; set; }
47 | [JsonProperty("html_source_path")]
48 | public string HtmlSourcePath { get; set; }
49 | [JsonProperty("blacklists_report_info")]
50 | public BlacklistsReportInfo BlacklistsReportInfo { get; set; }
51 | }
52 |
53 | public class BlacklistsReportInfo
54 | {
55 | public string Result { get; set; }
56 | public string Domain { get; set; }
57 | public string Ip { get; set; }
58 | public Report[] Report { get; set; }
59 | }
60 |
61 | public class Report
62 | {
63 | public string Name { get; set; }
64 | public string Url { get; set; }
65 | [JsonProperty("in_black_list")]
66 | public bool InBlackList { get; set; }
67 | }
68 | }
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("Relativity.Test.Helpers")]
8 | [assembly: AssemblyDescription("Relativity.Test.Helpers")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("Relativity")]
11 | [assembly: AssemblyProduct("Relativity.Test.Helpers")]
12 | [assembly: AssemblyCopyright("Copyright © 2019")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("500fcc47-7792-47e0-8308-ff7632c65cc9")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("7.5.3.1")]
35 | [assembly: AssemblyFileVersion("7.5.3.1")]
36 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/Relativity.Test.Helpers.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | Experimental
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/RetryHelper/IRetryLogicHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | namespace Relativity.Test.Helpers.RetryHelper
5 | {
6 | public interface IRetryLogicHelper
7 | {
8 | ///
9 | /// Retry a function that has an expected return
10 | ///
11 | ///
12 | ///
13 | ///
14 | ///
15 | ///
16 | T RetryFunction(int numberOfRetries, int delayInSeconds, Func operation);
17 |
18 | ///
19 | /// Retry an async function that has an expected return
20 | ///
21 | ///
22 | ///
23 | ///
24 | ///
25 | Task RetryFunctionAsync(int numberOfRetries, int delayInSeconds, Func> operation);
26 |
27 | ///
28 | /// Retry a function that has no return
29 | ///
30 | ///
31 | ///
32 | ///
33 | void RetryFunction(int numberOfRetries, int delayInSeconds, Action operation);
34 |
35 | ///
36 | /// Retry an async function that has no return
37 | ///
38 | ///
39 | ///
40 | ///
41 | ///
42 | Task RetryFunctionAsync(int numberOfRetries, int delayInSeconds, Func operation);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/RetryHelper/RetryHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using System.Threading.Tasks;
4 |
5 | public static class RetryHelper
6 | {
7 | public static void RetryOnException(int times, TimeSpan delay, Action operation)
8 | {
9 | var attempts = 0;
10 | do
11 | {
12 | try
13 | {
14 | attempts++;
15 | operation();
16 | break; // Sucess! Lets exit the loop!
17 | }
18 | catch (Exception ex)
19 | {
20 | if (attempts == times)
21 | throw;
22 |
23 | Console.WriteLine($"Exception caught on attempt {attempts} - will retry after delay {delay}", ex);
24 |
25 | Task.Delay(delay).Wait();
26 | }
27 | } while (true);
28 | }
29 | }
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/ServiceFactory/Extentions/ServiceManagerExtension.cs:
--------------------------------------------------------------------------------
1 | using Relativity.API;
2 | using Relativity.Services.ServiceProxy;
3 | using Relativity.Test.Helpers.SharedTestHelpers;
4 | using System;
5 |
6 | namespace Relativity.Test.Helpers.ServiceFactory.Extentions
7 | {
8 | public static class ServiceManagerExtension
9 | {
10 | public static T GetProxy(this IServicesMgr svcmgr, string username, string password) where T : IDisposable
11 | {
12 | //Create the ServiceFactory with the given credentials and urls
13 | ServiceFactorySettings serviceFactorySettings = new ServiceFactorySettings(svcmgr.GetServicesURL(), svcmgr.GetKeplerUrl(), new Relativity.Services.ServiceProxy.UsernamePasswordCredentials(username, password));
14 | Relativity.Services.ServiceProxy.ServiceFactory serviceFactory = new Relativity.Services.ServiceProxy.ServiceFactory(serviceFactorySettings);
15 | //Create proxy
16 | T proxy = serviceFactory.CreateProxy();
17 | return proxy;
18 |
19 | }
20 |
21 | public static Uri GetKeplerUrl(this IServicesMgr svcmgr)
22 | {
23 | // Get Kepler URL
24 | Uri keplerUri = new Uri($"{SharedTestHelpers.ConfigurationHelper.SERVER_BINDING_TYPE}://{SharedTestHelpers.ConfigurationHelper.REST_SERVER_ADDRESS}/relativity.rest/api");
25 | return keplerUri;
26 | }
27 |
28 | public static Uri GetKeplerUrl(this IServicesMgr svcmgr, AppConfigSettings alternateConfig)
29 | {
30 | // Get Kepler URL
31 | Uri keplerUri = new Uri($"{alternateConfig.ServerBindingType}://{alternateConfig.RelativityInstanceAddress}/relativity.rest/api");
32 | return keplerUri;
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/ServiceFactory/ServiceManagerExtension.cs:
--------------------------------------------------------------------------------
1 | using Relativity.API;
2 | using Relativity.Services.ServiceProxy;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace Relativity.Test.Helpers.Extensions
10 | {
11 | public static class ServiceManagerExtension
12 | {
13 | public static T GetProxy(this IServicesMgr svcmgr, string username, string password) where T : IDisposable
14 | {
15 | //Create the ServiceFactory with the given credentials and urls
16 | ServiceFactorySettings serviceFactorySettings = new ServiceFactorySettings(svcmgr.GetServicesURL(), svcmgr.GetKeplerUrl(), new Relativity.Services.ServiceProxy.UsernamePasswordCredentials(username, password));
17 | Relativity.Services.ServiceProxy.ServiceFactory serviceFactory = new Relativity.Services.ServiceProxy.ServiceFactory(serviceFactorySettings);
18 | //Create proxy
19 | T proxy = serviceFactory.CreateProxy();
20 | return proxy;
21 |
22 | }
23 |
24 |
25 | public static Uri GetKeplerUrl(this IServicesMgr svcmgr)
26 | {
27 | // Get Kepler URL
28 | Uri keplerUri = new Uri(string.Format("{0}://{1}/relativity.rest/api", SharedTestHelpers.ConfigurationHelper.SERVER_BINDING_TYPE, SharedTestHelpers.ConfigurationHelper.REST_SERVER_ADDRESS));
29 | return keplerUri;
30 | }
31 | }
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/ServiceFactory/ServicesManager.cs:
--------------------------------------------------------------------------------
1 | using Relativity.API;
2 | using Relativity.Services.ServiceProxy;
3 | using Relativity.Test.Helpers.ServiceFactory.Extentions;
4 | using Relativity.Test.Helpers.SharedTestHelpers;
5 | using System;
6 |
7 | namespace Relativity.Test.Helpers.ServiceFactory
8 | {
9 | public class ServicesManager : IServicesMgr
10 | {
11 | private readonly string _username;
12 | private readonly string _password;
13 | private readonly AppConfigSettings _alternateConfig;
14 |
15 | public ServicesManager(string username, string password)
16 | {
17 | _username = username;
18 | _password = password;
19 | }
20 |
21 | public ServicesManager(AppConfigSettings alternateConfig)
22 | {
23 | this._alternateConfig = alternateConfig;
24 | }
25 |
26 | public T CreateProxy(ExecutionIdentity ident) where T : IDisposable
27 | {
28 | Credentials creds = null;
29 |
30 | if (this._alternateConfig != null)
31 | {
32 | creds = new UsernamePasswordCredentials(_alternateConfig.AdminUserName, _alternateConfig.AdminPassword);
33 | }
34 | else
35 | {
36 | if (ident == ExecutionIdentity.CurrentUser)
37 | {
38 | creds = new UsernamePasswordCredentials(_username, _password);
39 | }
40 | else if (ident == ExecutionIdentity.System)
41 | {
42 | var username = SharedTestHelpers.ConfigurationHelper.ADMIN_USERNAME;
43 | var password = SharedTestHelpers.ConfigurationHelper.DEFAULT_PASSWORD;
44 | creds = new UsernamePasswordCredentials(username, password);
45 | }
46 | }
47 |
48 | if (creds == null)
49 | {
50 | throw new NotSupportedException($"{ident} is not supported in the Test Service Manager.");
51 | }
52 |
53 | ServiceFactorySettings serviceFactorySettings;
54 | Relativity.Services.ServiceProxy.ServiceFactory serviceFactory;
55 |
56 | if (this._alternateConfig != null)
57 | {
58 | serviceFactorySettings = new ServiceFactorySettings(GetServicesURL(), this.GetKeplerUrl(this._alternateConfig), creds);
59 | serviceFactory = new Relativity.Services.ServiceProxy.ServiceFactory(serviceFactorySettings);
60 | }
61 | else
62 | {
63 | serviceFactorySettings = new ServiceFactorySettings(GetServicesURL(), this.GetKeplerUrl(), creds);
64 | serviceFactory = new Relativity.Services.ServiceProxy.ServiceFactory(serviceFactorySettings);
65 | }
66 | T proxy = serviceFactory.CreateProxy();
67 | return proxy;
68 | }
69 |
70 | public Uri GetRESTServiceUrl()
71 | {
72 | Uri servicesUri;
73 |
74 | // Get Services URL
75 | if (this._alternateConfig != null)
76 | {
77 | string relativityInstance = (string.IsNullOrEmpty(this._alternateConfig.RestServerAddress) ? this._alternateConfig.RelativityInstanceAddress : this._alternateConfig.RestServerAddress);
78 | string serviceEndpoint = $"{this._alternateConfig.ServerBindingType}://{relativityInstance}/relativity.services";
79 | servicesUri = new Uri(serviceEndpoint);
80 | }
81 | else
82 | {
83 | servicesUri = new Uri($"{SharedTestHelpers.ConfigurationHelper.SERVER_BINDING_TYPE}://{SharedTestHelpers.ConfigurationHelper.RELATIVITY_INSTANCE_ADDRESS}/relativity.services");
84 | }
85 | return servicesUri;
86 | }
87 |
88 |
89 | public Uri GetServicesURL()
90 | {
91 | Uri servicesUri;
92 |
93 | // Get Services URL
94 | if (this._alternateConfig != null)
95 | {
96 | string relativityInstance = this._alternateConfig.RelativityInstanceAddress;
97 | string serviceEndpoint = $"{this._alternateConfig.ServerBindingType}://{relativityInstance}/relativity.services";
98 | servicesUri = new Uri(serviceEndpoint);
99 | }
100 | else
101 | {
102 | servicesUri = new Uri($"{SharedTestHelpers.ConfigurationHelper.SERVER_BINDING_TYPE}://{SharedTestHelpers.ConfigurationHelper.RELATIVITY_INSTANCE_ADDRESS}/relativity.services");
103 | }
104 | return servicesUri;
105 | }
106 | }
107 | }
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/ServiceFactory/URLHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Relativity.Test.Helpers.ServiceFactory
4 | {
5 | class URLHelper : API.IUrlHelper
6 | {
7 | public Uri GetApplicationURL(Guid appGuid)
8 | {
9 | throw new NotImplementedException();
10 | }
11 |
12 | public string GetRelativePathToCustomPages(Guid appGuid)
13 | {
14 | throw new NotImplementedException();
15 | }
16 |
17 |
18 |
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/SharedTestHelpers/AppConfigSettings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.Collections.Specialized;
5 | using System.Configuration;
6 |
7 | namespace Relativity.Test.Helpers.SharedTestHelpers
8 | {
9 | public class AppConfigSettings : ConfigurationSettings
10 | {
11 | private readonly NameValueCollection _appSettings;
12 |
13 | public AppConfigSettings()
14 | {
15 | _appSettings = ConfigurationManager.AppSettings;
16 | }
17 |
18 | public AppConfigSettings(string configSectionName)
19 | {
20 | _appSettings = (NameValueCollection)ConfigurationManager.GetSection(configSectionName);
21 | }
22 |
23 | public AppConfigSettings(Dictionary configDictionary)
24 | {
25 | _appSettings = new NameValueCollection();
26 |
27 | foreach (var keyValuePair in configDictionary)
28 | {
29 | _appSettings.Add(keyValuePair.Key, keyValuePair.Value);
30 | }
31 | }
32 |
33 | public override string TestDataLocation
34 | {
35 | get { return _appSettings["TestDataLocation"]; }
36 | }
37 |
38 | public override int WorkspaceId
39 | {
40 | get { return int.Parse(_appSettings["WorkspaceID"]); }
41 | }
42 |
43 | public override string RestServerAddress
44 | {
45 | get { return _appSettings["RESTServerAddress"]; }
46 | }
47 |
48 | public override string RelativityInstanceAddress
49 | {
50 | get { return _appSettings["RelativityInstanceAddress"]; }
51 | }
52 |
53 | public override string AdminUserName
54 | {
55 | get { return _appSettings["AdminUsername"]; }
56 | }
57 |
58 | public override string AdminPassword
59 | {
60 | get { return _appSettings["AdminPassword"]; }
61 | }
62 |
63 | public override string SqlServerAddress
64 | {
65 | get { return _appSettings["SQLServerAddress"]; }
66 | }
67 |
68 | public override string SqlUserName
69 | {
70 | get { return _appSettings["SQLUsername"]; }
71 | }
72 |
73 | public override string SqlPassword
74 | {
75 | get { return _appSettings["SQLPassword"]; }
76 | }
77 |
78 | public override string TestWorkspaceName
79 | {
80 | get { return _appSettings["TestWorkspaceName"]; }
81 | }
82 |
83 | public override string TestWorkspaceTemplateName
84 | {
85 | get { return _appSettings["TestWorkspaceTemplateName"]; }
86 | }
87 |
88 | public override string ServerBindingType
89 | {
90 | get { return _appSettings["ServerBindingType"]; }
91 | }
92 |
93 | public override string SqlConnectionString
94 | {
95 | get
96 | {
97 | var section = ConfigurationManager.GetSection("kCura.Config") as Hashtable;
98 | return (string)section["connectionString"];
99 | }
100 | }
101 |
102 | public override string RelAdminAuthToken
103 | {
104 | get
105 | {
106 | string credentialsString = string.Format("{0}:{1}", this.AdminUserName, this.AdminPassword);
107 | string credentialsB64 = Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(credentialsString));
108 | string authHdr = string.Format("Basic {0}", credentialsB64);
109 | return authHdr;
110 | }
111 | }
112 |
113 | public override string DistributedSqlAddress
114 | {
115 | get { return _appSettings["DistSQLServerAddress"]; }
116 | }
117 |
118 | public override string UploadTestingServiceRap
119 | {
120 | get { return _appSettings["UploadTestingServiceRap"]; }
121 | }
122 |
123 | public override string TestingServiceRapPath
124 | {
125 | get { return _appSettings["TestingServiceRapPath"]; }
126 | }
127 |
128 | public override string AgentServerAddress
129 | {
130 | get { return _appSettings["AgentServerAddress"] ?? "."; }
131 | }
132 |
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/SharedTestHelpers/ConfigurationHelpers.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Relativity.Test.Helpers.SharedTestHelpers
4 | {
5 | public static class ConfigurationHelper
6 | {
7 | private static ConfigurationSettings _settings;
8 | public static ConfigurationSettings Default
9 | {
10 | get
11 | {
12 | return new AppConfigSettings();
13 | }
14 | }
15 | static ConfigurationHelper()
16 | {
17 | SetupConfiguration(Default);
18 | }
19 | public static void SetupConfiguration(ConfigurationSettings settings)
20 | {
21 | _settings = settings;
22 | }
23 |
24 | public static void SetupConfiguration(Dictionary configDictionary)
25 | {
26 | _settings = new AppConfigSettings(configDictionary);
27 | }
28 |
29 | public static string TEST_DATA_LOCATION
30 | {
31 | get { return _settings.TestDataLocation; }
32 | }
33 |
34 | public static int WORKSPACEID
35 | {
36 | get { return _settings.WorkspaceId; }
37 | }
38 |
39 | public static string REST_SERVER_ADDRESS
40 | {
41 | get { return _settings.RestServerAddress; }
42 | }
43 |
44 | public static string RELATIVITY_INSTANCE_ADDRESS
45 | {
46 | get { return _settings.RelativityInstanceAddress; }
47 | }
48 |
49 | public static string ADMIN_USERNAME
50 | {
51 | get { return _settings.AdminUserName; }
52 | }
53 |
54 | public static string DEFAULT_PASSWORD
55 | {
56 | get { return _settings.AdminPassword; }
57 | }
58 |
59 | public static string SQL_SERVER_ADDRESS
60 | {
61 | get { return _settings.SqlServerAddress; }
62 | }
63 |
64 | public static string SQL_USER_NAME
65 | {
66 | get { return _settings.SqlUserName; }
67 | }
68 |
69 | public static string SQL_PASSWORD
70 | {
71 | get { return _settings.SqlPassword; }
72 | }
73 |
74 | public static string TEST_WORKSPACE_NAME
75 | {
76 | get { return _settings.TestWorkspaceName; }
77 | }
78 |
79 | public static string TEST_WORKSPACE_TEMPLATE_NAME
80 | {
81 | get { return _settings.TestWorkspaceTemplateName; }
82 | }
83 |
84 | public static string SERVER_BINDING_TYPE
85 | {
86 | get { return _settings.ServerBindingType; }
87 | }
88 |
89 | public static string SQL_CONNECTION_STRING
90 | {
91 | get
92 | {
93 | return _settings.SqlConnectionString;
94 | }
95 | }
96 |
97 | public static string AUTH_TOKEN_RELADMIN
98 | {
99 | get
100 | {
101 | return _settings.RelAdminAuthToken;
102 | }
103 | }
104 |
105 | public static string DISTRIBUTED_SQL_ADDRESS
106 | {
107 | get { return _settings.DistributedSqlAddress; }
108 | }
109 |
110 | public static string UPLOAD_TESTING_SERVICE_RAP
111 | {
112 | get { return _settings.UploadTestingServiceRap; }
113 | }
114 |
115 | public static string TESTING_SERVICE_RAP_PATH
116 | {
117 | get { return _settings.TestingServiceRapPath; }
118 | }
119 |
120 | public static string AGENT_SERVER_ADDRESS
121 | {
122 | get { return _settings.AgentServerAddress; }
123 | }
124 |
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/SharedTestHelpers/ConfigurationSettings.cs:
--------------------------------------------------------------------------------
1 | namespace Relativity.Test.Helpers.SharedTestHelpers
2 | {
3 | public abstract class ConfigurationSettings
4 | {
5 | public abstract string TestDataLocation
6 | {
7 | get;
8 | }
9 |
10 | public abstract int WorkspaceId
11 | {
12 | get;
13 | }
14 |
15 | public abstract string RestServerAddress
16 | {
17 | get;
18 | }
19 |
20 | public abstract string RelativityInstanceAddress
21 | {
22 | get;
23 | }
24 |
25 | public abstract string AdminUserName
26 | {
27 | get;
28 | }
29 |
30 | public abstract string AdminPassword
31 | {
32 | get;
33 | }
34 |
35 | public abstract string SqlServerAddress
36 | {
37 | get;
38 | }
39 |
40 | public abstract string SqlUserName
41 | {
42 | get;
43 | }
44 |
45 | public abstract string SqlPassword
46 | {
47 | get;
48 | }
49 |
50 | public abstract string TestWorkspaceName
51 | {
52 | get;
53 | }
54 |
55 | public abstract string TestWorkspaceTemplateName
56 | {
57 | get;
58 | }
59 |
60 | public abstract string ServerBindingType
61 | {
62 | get;
63 | }
64 |
65 | public abstract string SqlConnectionString
66 | {
67 | get;
68 | }
69 |
70 | public abstract string RelAdminAuthToken
71 | {
72 | get;
73 | }
74 |
75 | public abstract string DistributedSqlAddress
76 | {
77 | get;
78 | }
79 |
80 | public abstract string UploadTestingServiceRap
81 | {
82 | get;
83 | }
84 |
85 | public abstract string TestingServiceRapPath
86 | {
87 | get;
88 | }
89 |
90 | public abstract string AgentServerAddress
91 | {
92 | get;
93 | }
94 |
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/UserHelpers/create.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Relativity.Test.Helpers.UserHelpers
8 | {
9 | public class Create
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/cmmap000.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/cmmap000.bin
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/oilink.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/oilink.exe
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/oilink.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/oilink.jar
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccca-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccca-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccch-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccch-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccda-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccda-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccex-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccex-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccfa-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccfa-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccfi-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccfi-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccfmt-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccfmt-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccfnt-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccfnt-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccfut-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccfut-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccind-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccind-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/scclo-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/scclo-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccut-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/sccut-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/wvcore-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/oi/unmanaged/wvcore-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/sccfi.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/sccfi.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/sccfut.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/sccfut.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/scclo.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/scclo.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/sccut.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/sccut.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/wvcore.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Test.Helpers/wvcore.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/ImportAPI/ImportAPIHelperTest.cs:
--------------------------------------------------------------------------------
1 | using kCura.Relativity.DataReaderClient;
2 | using kCura.Relativity.ImportAPI;
3 | using kCura.Relativity.ImportAPI.Data;
4 | using kCura.Relativity.ImportAPI.Enumeration;
5 | using Moq;
6 | using NUnit.Framework;
7 | using Relativity.Test.Helpers.ImportAPIHelper;
8 | using Relativity.Test.Helpers.ImportAPIHelper.Request;
9 |
10 | namespace Relativity.Tests.Helpers.Tests.Unit.ImportAPI
11 | {
12 | [TestFixture]
13 | public class ImportAPIHelperTest
14 | {
15 | const int TEST_IDENTIFIER_FIELD_ID = 1015425;
16 | const string TEST_IDENTIFIER_FIELD_NAME = "Sample";
17 | IImportAPI iapi;
18 |
19 | [SetUp]
20 | public void Setup()
21 | {
22 | var iapiMocked = new Mock();
23 | var identifierField = Mock.Of();
24 | var fieldType = typeof(Field);
25 | fieldType.GetProperty("FieldCategory").SetValue(identifierField, FieldCategoryEnum.Identifier);
26 | fieldType.GetProperty("ArtifactID").SetValue(identifierField, TEST_IDENTIFIER_FIELD_ID);
27 | fieldType.GetProperty("Name").SetValue(identifierField, TEST_IDENTIFIER_FIELD_NAME);
28 |
29 |
30 | iapiMocked.Setup(p => p.GetWorkspaceFields(It.IsAny(), It.IsAny()))
31 | .Returns(new[]
32 | {
33 | identifierField
34 | });
35 | iapiMocked.Setup(p => p.NewNativeDocumentImportJob())
36 | .Returns(Mock.Of());
37 | iapiMocked.Setup(p => p.NewObjectImportJob(It.IsAny()))
38 | .Returns(Mock.Of());
39 |
40 | iapi = iapiMocked.Object;
41 | }
42 |
43 | [Test]
44 | public void GetImportJobTest()
45 | {
46 | //arrange
47 | var workspaceID = 1050630;
48 | var jobRequest = new ImportJobRequest(1050630);
49 |
50 | //act
51 | var importJob = ImportAPIHelper.GetImportJob(jobRequest, iapi);
52 |
53 | //assert
54 | Assert.AreEqual(workspaceID, importJob.Settings.CaseArtifactId);
55 | Assert.AreEqual(TEST_IDENTIFIER_FIELD_ID, importJob.Settings.IdentityFieldId);
56 | Assert.AreEqual(TEST_IDENTIFIER_FIELD_NAME, importJob.Settings.SelectedIdentifierFieldName);
57 | }
58 |
59 |
60 | [Test]
61 | public void GetDataTableTest()
62 | {
63 | //arrange
64 | var jobRequest = new ImportJobRequest(1050630);
65 | var importJob = ImportAPIHelper.GetImportJob(jobRequest, iapi);
66 |
67 | //act
68 | var dataTable = importJob.GetDocumentDataTableFromFolder(System.AppDomain.CurrentDomain.BaseDirectory);
69 |
70 | //assert
71 | Assert.Greater(dataTable.Rows.Count, 0);
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/Kepler/OAuth2HelperUnitTests.cs:
--------------------------------------------------------------------------------
1 | using Moq;
2 | using NUnit.Framework;
3 | using Relativity.Services.Interfaces.UserInfo;
4 | using Relativity.Services.Objects;
5 | using Relativity.Services.Security;
6 | using Relativity.Test.Helpers.Kepler;
7 | using Relativity.Tests.Helpers.Tests.Unit.MockHelpers;
8 | using System.Net.Http;
9 | using System.Threading.Tasks;
10 |
11 | namespace Relativity.Tests.Helpers.Tests.Unit.Kepler
12 | {
13 | [TestFixture]
14 | public class OAuth2HelperUnitTests
15 | {
16 | private Mock _mockOAuth2ClientManager;
17 | private Mock _mockUserManager;
18 | private Mock _mockObjectManager;
19 |
20 | private Mock _mockHttpMessageHandler;
21 | private IOAuth2Helper Sut;
22 |
23 | private const string Username = "test@test.com";
24 | private const string OAuth2Id = "OAuth2Id";
25 | private const string OAuth2Name = "OAuth2Name";
26 | private const string OAuth2Secret = "OAuth2Secret";
27 | private const int ContextUser = 999;
28 | private const string BearerToken = "abc1234567890.abc1234567890abc1234567890";
29 | private string _jsonBearer = @"{
30 | ""access_token"": ""@bearerToken"",
31 | ""expires_in"": 28800,
32 | ""token_type"": ""Bearer""
33 | }";
34 |
35 | [OneTimeSetUp]
36 | public void SetUp()
37 | {
38 | _jsonBearer = _jsonBearer.Replace("@bearerToken", BearerToken);
39 | _mockOAuth2ClientManager = MockOAuth2ClientManagerHelper.GetMockOAuth2ClientManager(OAuth2Id, OAuth2Name, OAuth2Secret, ContextUser);
40 | _mockUserManager = MockUserManagerHelper.GetMockUserManagerForOAuth();
41 | _mockObjectManager = MockObjectManagerHelper.GetMockObjectManagerForOAuth();
42 | _mockHttpMessageHandler = MockHttpMessageHandlerHelper.GetMockHttpMessageHandlerForBearerToken(_jsonBearer);
43 |
44 | Sut = new OAuth2Helper(_mockOAuth2ClientManager.Object, _mockUserManager.Object, _mockObjectManager.Object);
45 | }
46 |
47 | [OneTimeTearDown]
48 | public void TearDown()
49 | {
50 | Sut = null;
51 | }
52 |
53 | [Test]
54 | public async Task CreateOAuth2ClientAsyncTest()
55 | {
56 | // Arrange
57 |
58 | // Act
59 | Services.Security.Models.OAuth2Client result = await Sut.CreateOAuth2ClientAsync(Username, OAuth2Name);
60 |
61 | // Assert
62 | Assert.IsTrue(result.Id.Equals(OAuth2Id));
63 | }
64 |
65 | [Test]
66 | public void DeleteOAuth2ClientAsyncTest()
67 | {
68 | // Arrange
69 | string clientId = "1";
70 |
71 | // Act
72 |
73 | // Assert
74 | Assert.DoesNotThrow(() => Sut.DeleteOAuth2ClientAsync(clientId).Wait());
75 | }
76 |
77 | [Test]
78 | public async Task ReadOAuth2ClientAsyncTest()
79 | {
80 | // Arrange
81 |
82 | // Act
83 | Services.Security.Models.OAuth2Client result = await Sut.ReadOAuth2ClientAsync(OAuth2Name);
84 |
85 | // Assert
86 | Assert.IsTrue(result.Id.Equals(OAuth2Id));
87 | }
88 |
89 | [Test]
90 | public async Task DoesOAuth2ClientExistAsyncTest()
91 | {
92 | // Arrange
93 |
94 | // Act
95 | bool result = await Sut.DoesOAuth2ClientExistAsync(OAuth2Name);
96 |
97 | // Assert
98 | Assert.IsTrue(result);
99 | }
100 |
101 | [Test]
102 | public async Task GetBearerTokenAsyncTest()
103 | {
104 | // Arrange
105 | string protocol = "http";
106 | string serverAddress = "172.99.99.99";
107 | string clientId = "";
108 | string clientSecret = "";
109 | string scope = "";
110 | string grantType = "";
111 |
112 | // Act
113 | string result = await Sut.GetBearerTokenAsync(protocol, serverAddress, clientId, clientSecret, scope, grantType, _mockHttpMessageHandler.Object);
114 |
115 | // Assert
116 | Assert.IsTrue(result.Equals(BearerToken));
117 | }
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2006 Damien Miller (jBCrypt)
2 | Copyright (c) 2013 Ryan D. Emerle (.Net port)
3 |
4 | Permission to use, copy, modify, and distribute this software for any
5 | purpose with or without fee is hereby granted, provided that the above
6 | copyright notice and this permission notice appear in all copies.
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/MockHelpers/MockApplicationInstallManagerHelper.cs:
--------------------------------------------------------------------------------
1 | using Moq;
2 | using Relativity.Services.Interfaces.LibraryApplication;
3 | using Relativity.Services.Interfaces.LibraryApplication.Models;
4 | using Relativity.Services.Interfaces.Shared.Models;
5 | using System.Collections.Generic;
6 | using System.Threading.Tasks;
7 |
8 | namespace Relativity.Tests.Helpers.Tests.Unit.MockHelpers
9 | {
10 | public static class MockApplicationInstallManagerHelper
11 | {
12 | ///
13 | /// Creates some mock calls for basic use when installing an app. Has SetupSequence for when isApplicationAlreadyInstalled is false in some cases.
14 | ///
15 | ///
16 | ///
17 | ///
18 | public static Mock GetMockApplicationInstallManager(int workspaceApplicationId, bool isApplicationAlreadyInstalled)
19 | {
20 | Mock mockApplicationInstallManager = new Mock();
21 |
22 | InstallApplicationResponse installApplicationResponse = new InstallApplicationResponse();
23 | installApplicationResponse.Results = new List() { new InstallApplicationResult() };
24 | installApplicationResponse.ApplicationIdentifier = new ObjectIdentifier();
25 | installApplicationResponse.ApplicationIdentifier.ArtifactID = workspaceApplicationId;
26 |
27 | GetInstallStatusResponse getInstallStatusResponseInstalled = new GetInstallStatusResponse();
28 | getInstallStatusResponseInstalled.InstallStatus = new InstallStatus();
29 | getInstallStatusResponseInstalled.InstallStatus.Code = InstallStatusCode.Completed;
30 |
31 | GetInstallStatusResponse getInstallStatusResponseNotInstalled = new GetInstallStatusResponse();
32 | getInstallStatusResponseNotInstalled.InstallStatus = new InstallStatus();
33 | getInstallStatusResponseNotInstalled.InstallStatus.Code = InstallStatusCode.Failed;
34 |
35 | mockApplicationInstallManager
36 | .Setup(x => x.InstallApplicationAsync(It.IsAny(), It.IsAny(), It.IsAny()))
37 | .Returns(Task.FromResult(installApplicationResponse));
38 |
39 |
40 | if (isApplicationAlreadyInstalled)
41 | {
42 | mockApplicationInstallManager
43 | .Setup(x => x.GetStatusAsync(It.IsAny(), It.IsAny(), It.IsAny()))
44 | .ReturnsAsync(getInstallStatusResponseInstalled);
45 | }
46 | else
47 | {
48 | mockApplicationInstallManager
49 | .SetupSequence(x => x.GetStatusAsync(It.IsAny(), It.IsAny(), It.IsAny()))
50 | .ReturnsAsync(getInstallStatusResponseNotInstalled)
51 | .ReturnsAsync(getInstallStatusResponseInstalled);
52 | }
53 |
54 |
55 | return mockApplicationInstallManager;
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/MockHelpers/MockHttpMessageHandlerHelper.cs:
--------------------------------------------------------------------------------
1 | using Moq;
2 | using Moq.Protected;
3 | using System.Net;
4 | using System.Net.Http;
5 | using System.Threading;
6 | using System.Threading.Tasks;
7 |
8 | namespace Relativity.Tests.Helpers.Tests.Unit.MockHelpers
9 | {
10 | public static class MockHttpMessageHandlerHelper
11 | {
12 | ///
13 | /// Simple GET call mocked here for bearer token
14 | ///
15 | ///
16 | ///
17 | public static Mock GetMockHttpMessageHandlerForBearerToken(string jsonPayloadWithBearerToken)
18 | {
19 | Mock mockHttpMessageHandler = new Mock();
20 |
21 | mockHttpMessageHandler.Protected()
22 | .Setup>("SendAsync", ItExpr.IsAny(), ItExpr.IsAny())
23 | .ReturnsAsync(new HttpResponseMessage
24 | {
25 | StatusCode = HttpStatusCode.OK,
26 | Content = new StringContent(jsonPayloadWithBearerToken)
27 | });
28 |
29 | return mockHttpMessageHandler;
30 | }
31 |
32 | ///
33 | /// Simple POST call mocked here to get Relativity Version
34 | ///
35 | ///
36 | ///
37 | public static Mock GetMockHttpMessageHandlerForRelativityVersion(string expectedRelativityVersion)
38 | {
39 | Mock mockHttpMessageHandler = new Mock();
40 |
41 | mockHttpMessageHandler.Protected()
42 | .Setup>("SendAsync", ItExpr.Is(m => m.Method == HttpMethod.Post && m.RequestUri.OriginalString.Contains("GetRelativityVersionAsync")), ItExpr.IsAny())
43 | .ReturnsAsync(new HttpResponseMessage { Content = new StringContent(expectedRelativityVersion) });
44 |
45 | return mockHttpMessageHandler;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/MockHelpers/MockLibraryApplicationManagerHelper.cs:
--------------------------------------------------------------------------------
1 | using Moq;
2 | using Relativity.Kepler.Transport;
3 | using Relativity.Services.Interfaces.LibraryApplication;
4 | using Relativity.Services.Interfaces.LibraryApplication.Models;
5 | using Relativity.Services.Interfaces.Shared.Models;
6 | using System;
7 | using System.Collections.Generic;
8 | using System.Threading.Tasks;
9 |
10 | namespace Relativity.Tests.Helpers.Tests.Unit.MockHelpers
11 | {
12 | public static class MockLibraryApplicationManagerHelper
13 | {
14 | ///
15 | /// Creates some mock calls for basic use when installing an app. Has SetupSequence for when isApplicationAlreadyInstalled is false in some cases.
16 | ///
17 | ///
18 | ///
19 | ///
20 | ///
21 | ///
22 | public static Mock GetMockLibraryApplicationManager(string applicationName, Guid applicationGuid, int libraryApplicationId, bool isApplicationAlreadyInstalled)
23 | {
24 | Mock mockLibraryApplicationManager = new Mock();
25 |
26 | GetInstallStatusResponse getInstallStatusResponse = new GetInstallStatusResponse();
27 | getInstallStatusResponse.InstallStatus = new InstallStatus();
28 | getInstallStatusResponse.InstallStatus.Code = InstallStatusCode.Completed;
29 |
30 | CreateLibraryApplicationResponse createLibraryApplicationResponse = new CreateLibraryApplicationResponse();
31 | createLibraryApplicationResponse.ApplicationIdentifier = new ObjectIdentifier();
32 | createLibraryApplicationResponse.ApplicationIdentifier.ArtifactID = libraryApplicationId;
33 |
34 | List allAppsInstalled = new List();
35 | allAppsInstalled.Add(new LibraryApplicationResponse()
36 | {
37 | Name = applicationName,
38 | Guids = new List() { applicationGuid }
39 | });
40 |
41 | List allAppsNotInstalled = new List();
42 | allAppsNotInstalled.Add(new LibraryApplicationResponse()
43 | {
44 | Name = string.Empty,
45 | Guids = new List() { Guid.Empty }
46 | });
47 |
48 | mockLibraryApplicationManager
49 | .Setup(x => x.GetLibraryInstallStatusAsync(It.IsAny(), It.IsAny()))
50 | .ReturnsAsync(getInstallStatusResponse);
51 | mockLibraryApplicationManager
52 | .Setup(x => x.CreateAsync(It.IsAny(), It.IsAny()))
53 | .ReturnsAsync(createLibraryApplicationResponse);
54 | mockLibraryApplicationManager
55 | .Setup(x => x.DeleteAsync(It.IsAny(), It.IsAny()))
56 | .Returns(Task.CompletedTask);
57 |
58 | if (isApplicationAlreadyInstalled)
59 | {
60 | mockLibraryApplicationManager
61 | .Setup(x => x.ReadAllAsync(It.IsAny()))
62 | .ReturnsAsync(allAppsInstalled);
63 | }
64 | else
65 | {
66 | mockLibraryApplicationManager
67 | .SetupSequence(x => x.ReadAllAsync(It.IsAny()))
68 | .ReturnsAsync(allAppsNotInstalled)
69 | .ReturnsAsync(allAppsInstalled);
70 | }
71 |
72 | return mockLibraryApplicationManager;
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/MockHelpers/MockOAuth2ClientManagerHelper.cs:
--------------------------------------------------------------------------------
1 | using Moq;
2 | using Relativity.Services.Security;
3 | using Relativity.Services.Security.Models;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Threading.Tasks;
7 |
8 | namespace Relativity.Tests.Helpers.Tests.Unit.MockHelpers
9 | {
10 | public static class MockOAuth2ClientManagerHelper
11 | {
12 | ///
13 | /// Basic mocks for OAuth2 manager
14 | ///
15 | ///
16 | ///
17 | ///
18 | ///
19 | ///
20 | public static Mock GetMockOAuth2ClientManager(string oAuth2Id, string oAuth2Name, string oAuth2Secret, int contextUser)
21 | {
22 | Mock mockOAuth2ClientManager = new Mock();
23 | Services.Security.Models.OAuth2Client oAuth2Client = new Services.Security.Models.OAuth2Client()
24 | {
25 | Id = oAuth2Id,
26 | Name = oAuth2Name,
27 | Secret = oAuth2Secret,
28 | ContextUser = contextUser
29 | };
30 | List oAuth2Clients = new List() { oAuth2Client };
31 |
32 | mockOAuth2ClientManager
33 | .Setup(x => x.CreateAsync(It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny()))
34 | .Returns(Task.FromResult(oAuth2Client));
35 |
36 | mockOAuth2ClientManager
37 | .Setup(x => x.DeleteAsync(It.IsAny()))
38 | .Returns(Task.CompletedTask);
39 |
40 | mockOAuth2ClientManager
41 | .Setup(x => x.ReadAllAsync())
42 | .Returns(Task.FromResult(oAuth2Clients));
43 |
44 | return mockOAuth2ClientManager;
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/MockHelpers/MockObjectManagerHelper.cs:
--------------------------------------------------------------------------------
1 | using Castle.Components.DictionaryAdapter;
2 | using Moq;
3 | using Relativity.Services.Objects;
4 | using Relativity.Services.Objects.DataContracts;
5 |
6 | namespace Relativity.Tests.Helpers.Tests.Unit.MockHelpers
7 | {
8 | public static class MockObjectManagerHelper
9 | {
10 | ///
11 | /// Creates a Mock IUserInfoManager for the OAuth helper
12 | ///
13 | ///
14 | public static Mock GetMockObjectManagerForOAuth()
15 | {
16 | Mock mockObjectManager = new Mock();
17 |
18 | QueryResult queryResult = new QueryResult()
19 | {
20 | Objects = new EditableList()
21 | {
22 | new RelativityObject()
23 | {
24 | ArtifactID = 999
25 | }
26 | }
27 | };
28 |
29 | mockObjectManager.Setup(x => x.QueryAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()))
30 | .ReturnsAsync(queryResult);
31 |
32 | return mockObjectManager;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/MockHelpers/MockUserManagerHelper.cs:
--------------------------------------------------------------------------------
1 | using Moq;
2 | using Relativity.Services.Interfaces.UserInfo;
3 | using Relativity.Services.Interfaces.UserInfo.Models;
4 |
5 | namespace Relativity.Tests.Helpers.Tests.Unit.MockHelpers
6 | {
7 | public static class MockUserManagerHelper
8 | {
9 | ///
10 | /// Creates a Mock IUserInfoManager for the OAuth helper
11 | ///
12 | ///
13 | public static Mock GetMockUserManagerForOAuth()
14 | {
15 | Mock mockUserInfoManager = new Mock();
16 |
17 | UserResponse userResponse = new UserResponse()
18 | {
19 | ArtifactID = 999,
20 | EmailAddress = "test@test.com"
21 | };
22 |
23 | mockUserInfoManager.Setup(x => x.ReadAsync(It.IsAny()))
24 | .ReturnsAsync(userResponse);
25 |
26 | return mockUserInfoManager;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | [assembly: AssemblyTitle("Relativity.Tests.Helpers.Tests.Unit")]
5 | [assembly: AssemblyDescription("")]
6 | [assembly: AssemblyConfiguration("")]
7 | [assembly: AssemblyCompany("")]
8 | [assembly: AssemblyProduct("Relativity.Tests.Helpers.Tests.Unit")]
9 | [assembly: AssemblyCopyright("Copyright © 2017")]
10 | [assembly: AssemblyTrademark("")]
11 | [assembly: AssemblyCulture("")]
12 |
13 | [assembly: ComVisible(false)]
14 |
15 | [assembly: Guid("cb3d61d1-8e16-48f6-8cb9-1d2a71d339fa")]
16 |
17 | // [assembly: AssemblyVersion("1.0.*")]
18 | [assembly: AssemblyVersion("7.5.3.1")]
19 | [assembly: AssemblyFileVersion("7.5.3.1")]
20 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/RetryHelper/RetryLogicHelperUnitTests.cs:
--------------------------------------------------------------------------------
1 | using Moq;
2 | using NUnit.Framework;
3 | using Relativity.API;
4 | using Relativity.OAuth2Client.Exceptions;
5 | using Relativity.Test.Helpers.Exceptions;
6 | using Relativity.Test.Helpers.Kepler;
7 | using Relativity.Test.Helpers.RetryHelper;
8 | using System;
9 | using System.Threading.Tasks;
10 |
11 | namespace Relativity.Tests.Helpers.Tests.Unit.RetryHelper
12 | {
13 | [TestFixture]
14 | public class RetryLogicHelperUnitTests
15 | {
16 | private Mock _mockOAuth2Helper;
17 | private Mock _mockHelper;
18 |
19 | private RetryLogicHelper SuT;
20 |
21 | private const string OAuth2Id = "OAuth2Id";
22 | private const string OAuth2Secret = "OAuth2Secret";
23 | private readonly Guid AppGuid = new Guid("99999999-9a99-9a9a-9a99-9aaa9aa99999");
24 |
25 | [SetUp]
26 | public void SetUp()
27 | {
28 | _mockOAuth2Helper = new Mock();
29 | _mockHelper = new Mock();
30 |
31 | SuT = new RetryLogicHelper();
32 | }
33 |
34 | [TearDown]
35 | public void TearDown()
36 | {
37 |
38 | }
39 |
40 | [TestCase(2, 2)]
41 | public void RetryFunction_Return_Valid(int numberOfRetries, int delayInSeconds)
42 | {
43 | // Arrange
44 | int workspaceId = 10;
45 | int artifactId = 10;
46 |
47 | _mockHelper
48 | .SetupSequence(x => x.GetGuid(It.IsAny(), It.IsAny()))
49 | .Throws(new TestHelpersException("Fake error, needs to retry"))
50 | .Returns(AppGuid);
51 |
52 | // Act
53 | Guid result = SuT.RetryFunction(numberOfRetries, delayInSeconds, () => _mockHelper.Object.GetGuid(workspaceId, artifactId));
54 |
55 | // Assert
56 | Assert.AreEqual(AppGuid, result);
57 | }
58 |
59 | [TestCase(2, 2)]
60 | public async Task RetryFunctionAsync_Return_Valid(int numberOfRetries, int delayInSeconds)
61 | {
62 | // Arrange
63 | Services.Security.Models.OAuth2Client oAuth2Client = new Services.Security.Models.OAuth2Client()
64 | {
65 | Id = OAuth2Id
66 | };
67 |
68 | _mockOAuth2Helper
69 | .SetupSequence(x => x.CreateOAuth2ClientAsync(It.IsAny(), It.IsAny()))
70 | .ThrowsAsync(new OAuth2ClientException("Fake error, needs to retry"))
71 | .ReturnsAsync(oAuth2Client);
72 |
73 | // Act
74 | Services.Security.Models.OAuth2Client result = await SuT.RetryFunctionAsync(numberOfRetries, delayInSeconds, async () => await _mockOAuth2Helper.Object.CreateOAuth2ClientAsync(OAuth2Id, OAuth2Secret));
75 |
76 | // Assert
77 | Assert.AreEqual(OAuth2Id, oAuth2Client.Id);
78 | }
79 |
80 | [TestCase(2, 2)]
81 | public void RetryFunction_Void_Valid(int numberOfRetries, int delayInSeconds)
82 | {
83 | // Arrange
84 | Task completedTask = Task.CompletedTask;
85 |
86 | _mockOAuth2Helper
87 | .SetupSequence(x => x.DeleteOAuth2ClientAsync(It.IsAny()))
88 | .Throws(new OAuth2ClientException("Fake error, needs to retry"))
89 | .Returns(completedTask);
90 |
91 | // Act
92 |
93 | // Assert
94 | Assert.DoesNotThrow(() => SuT.RetryFunction(numberOfRetries, delayInSeconds, () => _mockOAuth2Helper.Object.DeleteOAuth2ClientAsync(OAuth2Id).Wait()));
95 | }
96 |
97 | [TestCase(2, 2)]
98 | public async Task RetryFunctionAsync_Void_Valid(int numberOfRetries, int delayInSeconds)
99 | {
100 | // Arrange
101 | await Task.Yield();
102 | Task completedTask = Task.CompletedTask;
103 |
104 | _mockOAuth2Helper
105 | .SetupSequence(x => x.DeleteOAuth2ClientAsync(It.IsAny()))
106 | .Throws(new OAuth2ClientException("Fake error, needs to retry"))
107 | .Returns(completedTask);
108 |
109 | // Act
110 |
111 | // Assert
112 | Assert.DoesNotThrowAsync(async () => await SuT.RetryFunctionAsync(numberOfRetries, delayInSeconds, async () => await _mockOAuth2Helper.Object.DeleteOAuth2ClientAsync(OAuth2Id)));
113 | }
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/cmmap000.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/cmmap000.bin
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/oilink.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/oilink.exe
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/oilink.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/oilink.jar
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccca-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccca-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccch-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccch-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccda-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccda-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccex-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccex-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccfa-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccfa-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccfi-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccfi-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccfmt-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccfmt-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccfnt-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccfnt-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccfut-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccfut-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccind-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccind-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/scclo-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/scclo-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccut-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/sccut-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/wvcore-R1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/oi/unmanaged/wvcore-R1.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/Relativity.Tests.Helpers.Tests.Unit/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/lib/Relativity.Authentication.Interfaces.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/lib/Relativity.Authentication.Interfaces.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/lib/Relativity.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/lib/Relativity.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/lib/kCura.Config.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/lib/kCura.Config.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/lib/kCura.Crypto.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/lib/kCura.Crypto.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/lib/kCura.Data.RowDataGateway.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/lib/kCura.Data.RowDataGateway.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/lib/kCura.Data.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/lib/kCura.Data.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/lib/kCura.OI.FileID.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/lib/kCura.OI.FileID.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/lib/kCura.Relativity.DataReaderClient.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/lib/kCura.Relativity.DataReaderClient.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/lib/kCura.Relativity.ImportAPI.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/lib/kCura.Relativity.ImportAPI.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/lib/kCura.Utility.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/lib/kCura.Utility.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/lib/kCura.WinEDDS.ImportExtension.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/lib/kCura.WinEDDS.ImportExtension.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/lib/kCura.WinEDDS.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/lib/kCura.WinEDDS.dll
--------------------------------------------------------------------------------
/Source/Relativity.Test.Helpers/lib/kCura.Windows.Process.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/relativitydev/relativity-test-helpers/3b0f106a38be3ece47439a597cda5632f673d09b/Source/Relativity.Test.Helpers/lib/kCura.Windows.Process.dll
--------------------------------------------------------------------------------
/build-pipeline.yml:
--------------------------------------------------------------------------------
1 | # Build Pipeline for Relativity Test Helpers
2 |
3 | pool:
4 | vmImage: 'windows-latest'
5 |
6 | variables:
7 | solution: '**/*.sln'
8 | buildPlatform: 'Any CPU'
9 | buildConfiguration: 'Release'
10 |
11 | # Install NuGet Installer tool
12 | steps:
13 | - task: NuGetToolInstaller@0
14 |
15 | # Restore NuGet packages for the Visual Studio Solution
16 | - task: NuGetCommand@2
17 | inputs:
18 | restoreSolution: '$(solution)'
19 |
20 | # Build Visual Studio Solution
21 | - task: VSBuild@1
22 | inputs:
23 | solution: '$(solution)'
24 | msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
25 | platform: '$(buildPlatform)'
26 | configuration: '$(buildConfiguration)'
27 |
28 | # Run Integration tests only when merging from develop to Master. This is achieved by setting a 'condition' to the task
29 | - task: VSTest@2
30 | condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
31 | inputs:
32 | testSelector: 'testAssemblies'
33 | testAssemblyVer2: |
34 | **\bin\**\Relativity.Test.Helpers.NUnit.Integration.dll
35 | searchFolder: '$(System.DefaultWorkingDirectory)'
36 | distributionBatchType: basedOnAssembly
37 | runSettingsFile: 'Source\Relativity.Test.Helpers\Relativity.Test.Helpers.NUnit.Integration\test.runsettings'
38 | overrideTestrunParameters:
39 | -TestWorkspaceName $(testWorkspaceName)
40 | -TestWorkspaceTemplateName $(testWorkspaceTemplateName)
41 | -AdminUsername $(adminUsername)
42 | -AdminPassword $(adminPassword)
43 | -SQLUserName $(sqlUserName)
44 | -SQLPassword $(sqlPassword)
45 | -SQLServerAddress $(sqlServerAddress)
46 | -RESTServerAddress $(restServerAddress)
47 | -ServerBindingType $(serverBindingType)
48 | -RelativityInstanceAddress $(relativityInstanceAddress)
49 | -GmailMailTestEmailAddress $(gmailMailTestEmailAddress)
50 | -GmailMailTestEmailPassword $(gmailMailTestEmailPassword)
51 | -MailTrapTestApiKey $(mailTrapTestApiKey)
52 | -MailTrapTestEmailAddress $(mailTrapTestEmailAddress)
53 | -MailTrapTestEmailUsername $(mailTrapTestEmailUsername)
54 | -MailTrapTestEmailPassword $(mailTrapTestEmailPassword)
55 |
56 | # Copy the required Project DLL's to Artifact Staging Directory
57 | - task: CopyFiles@2
58 | inputs:
59 | SourceFolder: '$(system.defaultworkingdirectory)'
60 | Contents: '**\bin\**'
61 | TargetFolder: '$(build.artifactstagingdirectory)'
62 |
63 | # Copy NuGet spec file to Artifact Staging Directory
64 | - task: CopyFiles@2
65 | inputs:
66 | SourceFolder: '$(system.defaultworkingdirectory)'
67 | Contents: '*.nuspec*'
68 | TargetFolder: '$(build.artifactstagingdirectory)'
69 |
70 | # Copy NuGet targets file to Artifact Staging Directory
71 | - task: CopyFiles@2
72 | inputs:
73 | SourceFolder: '$(system.defaultworkingdirectory)'
74 | Contents: '*.targets*'
75 | TargetFolder: '$(build.artifactstagingdirectory)'
76 |
77 | # Copy the variables.json file which contains the version numbers for the NuGet package to Artifact Staging Directory
78 | - task: CopyFiles@2
79 | inputs:
80 | SourceFolder: '$(system.defaultworkingdirectory)'
81 | Contents: 'variables.json'
82 | TargetFolder: '$(build.artifactstagingdirectory)'
83 |
84 | # Publish Artifact Staging Directory to a Container to be accessed in Release pipeline for publishing NuGet package
85 | - task: PublishBuildArtifacts@1
86 | inputs:
87 | PathtoPublish: '$(build.artifactStagingDirectory)'
88 | ArtifactName: 'drop'
89 | publishLocation: 'Container'
90 |
--------------------------------------------------------------------------------
/scheduled-build-pipeline.yml:
--------------------------------------------------------------------------------
1 | # Build Pipeline for Relativity Test Helpers - Builds and runs tests only on Saturdays at 6:00am CT
2 |
3 | pr: none
4 | trigger: none
5 |
6 | schedules:
7 | # Runs every saturday at 6:00am Central Time (11:00am UTC is 6:00am CT)
8 | - cron: "0 11 * * 6"
9 | displayName: Weekly Saturday build
10 | branches:
11 | include:
12 | - master
13 | always: true
14 |
15 | pool:
16 | vmImage: 'windows-latest'
17 |
18 | variables:
19 | solution: '**/*.sln'
20 | buildPlatform: 'Any CPU'
21 | buildConfiguration: 'Release'
22 |
23 | steps:
24 | - task: NuGetToolInstaller@0
25 |
26 | - task: NuGetCommand@2
27 | inputs:
28 | restoreSolution: '$(solution)'
29 |
30 | - task: VSBuild@1
31 | inputs:
32 | solution: '$(solution)'
33 | msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
34 | platform: '$(buildPlatform)'
35 | configuration: '$(buildConfiguration)'
36 |
37 | - task: VSTest@2
38 | inputs:
39 | testSelector: 'testAssemblies'
40 | testAssemblyVer2: |
41 | **\bin\**\Relativity.Test.Helpers.NUnit.Integration.dll
42 | searchFolder: '$(System.DefaultWorkingDirectory)'
43 | distributionBatchType: basedOnAssembly
44 | runSettingsFile: 'Source\Relativity.Test.Helpers\Relativity.Test.Helpers.NUnit.Integration\test.runsettings'
45 | overrideTestrunParameters:
46 | -TestWorkspaceName $(testWorkspaceName)
47 | -TestWorkspaceTemplateName $(testWorkspaceTemplateName)
48 | -AdminUsername $(adminUsername)
49 | -AdminPassword $(adminPassword)
50 | -SQLUserName $(sqlUserName)
51 | -SQLPassword $(sqlPassword)
52 | -SQLServerAddress $(sqlServerAddress)
53 | -RESTServerAddress $(restServerAddress)
54 | -ServerBindingType $(serverBindingType)
55 | -RelativityInstanceAddress $(relativityInstanceAddress)
56 | -GmailMailTestEmailAddress $(gmailMailTestEmailAddress)
57 | -GmailMailTestEmailPassword $(gmailMailTestEmailPassword)
58 | -MailTrapTestApiKey $(mailTrapTestApiKey)
59 | -MailTrapTestEmailAddress $(mailTrapTestEmailAddress)
60 | -MailTrapTestEmailUsername $(mailTrapTestEmailUsername)
61 | -MailTrapTestEmailPassword $(mailTrapTestEmailPassword)
--------------------------------------------------------------------------------
/variables.json:
--------------------------------------------------------------------------------
1 | {
2 | "devVersion":"9.0.0.1-DEV-0",
3 | "productionVersion":"9.0.0.1"
4 | }
--------------------------------------------------------------------------------