public UnitTestBase() { var testContainer = new TestsContainer(); _container = testContainer.GetContainerBuilder(); _container.Resolve <IEnumerable <IMapConfiguration> >().ToList().ForEach(x => x.Map()); _container.Resolve <IEventRegisterListeners>().RegisterListeners(); _translationsService = _container.Resolve <ITranslationsService>(); _emailSenderMock = testContainer.EmailSenderMoq; HttpContext.Current = HttpContext.Current = new HttpContext( new HttpRequest("", "http://tempuri.org", ""), new HttpResponse(new StringWriter()) ); HttpContext.Current.User = new GenericPrincipal( new ClaimsIdentity(new[] { new Claim(ClaimTypes.Role, RoleIds.SuperAdmin.ToString()), new Claim(ClaimTypes.NameIdentifier, Guid.NewGuid().ToString()), }), new string[0] ); }
public static TestsContainer LoadTests() { TestsContainer Container = new TestsContainer(); TestLoader.LoadTest(out Container); return(Container); }
static void SaveTests(string path, TestsContainer container) { File.WriteAllText(path, JsonConvert.SerializeObject(container, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() })); }
private void CreateContainer() { if (TestsContainer == null) { TestsContainer = new TestsContainer(); } if (TestsContainer.Tests == null) { TestsContainer.Tests = new Test[1]; CreateSampleTest(); } }
public static void LoadTest(out TestsContainer test_man) { try { string resources_path = TestCreator.Instance.AssetsPath + TestCreator.Instance.TestsFileName; TextAsset file = Resources.Load <TextAsset>(resources_path); string json_contents = System.Text.Encoding.UTF7.GetString(file.bytes); test_man = JsonUtility.FromJson <TestsContainer>(json_contents); } catch (System.Exception) { test_man = null; Debug.LogError("Critical error loading the tests file."); } }
public void CreateSampleTest() { if (TestsContainer == null) { TestsContainer = new TestsContainer(); } if (Tests == null || Tests.Length <= 0) { Tests = new Test[1] { GetSampleTest() } } ; SaveTests(); }