public async Task GetDependency() { var at = new ActinTest(); var child = await at.GetInitializedActor <Child>(); Assert.NotNull(child); var parentOnly = at.GetDependency <ParentOnly>(child); Assert.Equal(child.ParentOnly, parentOnly); var childOnly = at.GetDependency <ChildOnly>(child); Assert.Equal(child.ChildOnly, childOnly); var parentAndChild_child = at.GetDependency <ParentAndChild>(child); Assert.Equal(child.ParentAndChild_Child, parentAndChild_child); }
public async Task GenerateSceneChildren() { var at = new ActinTest(); var scene = at.GetActor <SceneParent>(); Assert.NotNull(scene); await at.RunActor(scene); var allChildren = scene.Actors_GetAll(); Assert.Contains(allChildren, x => x.Id == 1); Assert.Contains(allChildren, x => x.Id == 2); Assert.Contains(allChildren, x => x.Id == 3); var child = allChildren.First(); Assert.NotNull(child.Singleton); Assert.NotNull(child.Instance); Assert.NotNull(child.Parent); Assert.Equal(scene, child.Parent); }
public async Task LogToDisk() { var at = new ActinTest(); var standardLogger = await at.GetInitializedActor <ActinStandardLogger>(); standardLogger.LogToDisk = true; standardLogger.SetLogFolderPath("./log"); var time = new DateTimeOffset(new DateTime(1970, 1, 1), new TimeSpan()); standardLogger.DeleteTodaysLog(time); try { standardLogger.Log(new ActinLog(time, "context", "location", "userMessage", "details", LogType.Error)); await at.RunActor(standardLogger, time); var logFile = new DirectoryInfo("./log").GetFiles().First(); var logFileLines = await File.ReadAllLinesAsync(logFile.FullName); var expectedOutput = new string[] { "<Logs>", "<Log time=\"1/1/1970 12:00:00 AM +00:00\" type=\"Error\" location=\"location\" context=\"context\">", " userMessage", " details", "</Log>", "</Logs>" }; Assert.Equal(expectedOutput.Length, logFileLines.Length); for (int i = 0; i < logFileLines.Length; i++) { Assert.Equal(expectedOutput[i], logFileLines[i]); } } finally { standardLogger.DeleteTodaysLog(time); } }