public void ExtractAndIdentifyTarFiles() { var uuid = Uuid.Of("c3db9d4e-720c-4f75-bfb6-de90231dc44c"); string pathToExtractedFilesRegex = ArkadeProcessingArea.WorkDirectory.FullName + Path.DirectorySeparatorChar + "..............-" + uuid + Path.DirectorySeparatorChar + uuid; pathToExtractedFilesRegex = pathToExtractedFilesRegex.Replace("\\", "\\\\"); var extractorMock = new Mock <ICompressionUtility>(); extractorMock.Setup(e => e.ExtractFolderFromArchive(It.IsAny <FileInfo>(), It.IsAny <DirectoryInfo>())); var archiveType = ArchiveType.Noark5; var identifierMock = new Mock <IArchiveIdentifier>(); identifierMock.Setup(i => i.Identify(It.IsAny <string>())).Returns(archiveType); var statusEventHandler = new StatusEventHandler(); string file = TestUtil.TestDataDirectory + Path.DirectorySeparatorChar + "tar" + Path.DirectorySeparatorChar + "Noark3-eksempel-1" + Path.DirectorySeparatorChar + uuid + ".tar"; TestSession testSession = new TestSessionFactory(extractorMock.Object, statusEventHandler) .NewSession(ArchiveFile.Read(file, archiveType)); var archive = testSession.Archive; archive.Should().NotBeNull(); archive.Uuid.Should().Be(uuid); archive.WorkingDirectory.Root().DirectoryInfo().FullName.Should().MatchRegex(pathToExtractedFilesRegex); archive.ArchiveType.Should().Be(archiveType); System.IO.Directory.Delete(archive.WorkingDirectory.Root().DirectoryInfo().FullName, true); }
public ArkadeApi(TestSessionFactory testSessionFactory, TestEngineFactory testEngineFactory, MetadataFilesCreator metadataFilesCreator, InformationPackageCreator informationPackageCreator, TestSessionXmlGenerator testSessionXmlGenerator) { _testSessionFactory = testSessionFactory; _testEngineFactory = testEngineFactory; _metadataFilesCreator = metadataFilesCreator; _informationPackageCreator = informationPackageCreator; _testSessionXmlGenerator = testSessionXmlGenerator; }
public void AnotherTest() { using (ISession db = TestSessionFactory.OpenSession()) { var query = (from t in db.Query <Teacher>() select t).ToList(); Assert.AreEqual(0, query.Count); } }
static void Main(string[] args) { string directory = @"C:\Dropbox (Arkitektum AS)\Arkade5 - Testdata\Komplette uttrekk\Noark5-alice-liten\"; string archiveFileName = directory + @"ee07a0f9-4564-43ab-b80d-ac975ba12aed.tar"; string metadataFileName = directory + @"info.xml"; ArchiveType archiveType = ArchiveType.Noark5; if (args.Length != 0) { archiveFileName = args[0]; metadataFileName = args[1]; } var builder = new ContainerBuilder(); builder.RegisterModule(new ArkadeAutofacModule()); var container = builder.Build(); Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() .WriteTo.ColoredConsole(outputTemplate: "{Timestamp:yyyy-MM-ddTHH:mm:ss.fff} {SourceContext} [{Level}] {Message}{NewLine}{Exception}") .CreateLogger(); using (container.BeginLifetimeScope()) { TestSessionFactory testSessionBuilder = container.Resolve <TestSessionFactory>(); TestSession testSession = testSessionBuilder.NewSession(ArchiveFile.Read(archiveFileName, archiveType)); Console.WriteLine($"Reading from archive: {archiveFileName}"); Console.WriteLine($"Uuid: {testSession.Archive.Uuid}"); Console.WriteLine($"WorkingDirectory: {testSession.Archive.WorkingDirectory}"); Console.WriteLine($"ArchiveType: {testSession.Archive.ArchiveType}"); TestEngineFactory testEngineFactory = container.Resolve <TestEngineFactory>(); ITestEngine testEngine = testEngineFactory.GetTestEngine(testSession); TestSuite testSuite = testEngine.RunTestsOnArchive(testSession); foreach (TestRun testRun in testSuite.TestRuns) { Console.WriteLine($"Test: {testRun.TestName}, duration={testRun.TestDuration}, success={testRun.IsSuccess()}"); } } }
public void TestMethod1() { using (ISession db = TestSessionFactory.OpenSession()) { Teacher teacher = new Teacher { Name = "test teacher" }; db.Save(teacher); SchoolClass schoolClass = new SchoolClass { Name = "MTH 101", TeacherId = 1 }; db.Save(schoolClass); Student student = new Student { Name = "Joe", classid = 1 }; db.Save(student); var query = (from t in db.Query <Teacher>() join c in db.Query <SchoolClass>() on t.Id equals c.TeacherId join s in db.Query <Student>() on c.Id equals s.classid select new { TeacherName = t.Name, ClassName = c.Name, StudentName = s.Name }).ToList(); Assert.AreEqual(1, query.Count); } }
public void ThirdTest() { using (ISession db = TestSessionFactory.OpenSession()) { Teacher teacher = new Teacher { Name = "test teacher" }; db.Save(teacher); teacher = new Teacher { Name = "test teacher2" }; db.Save(teacher); var query = (from t in db.Query <Teacher>() select t).ToList(); Assert.AreEqual(2, query.Count); } }
public void CreateSessionAndRepository() { Session = TestSessionFactory.OpenSession(); Repository = (TRepository)Activator.CreateInstance(typeof(TRepository), Session); }
/// <summary> /// Initializes a new instance of the <see cref="T:System.Object" /> class. /// </summary> public PostDataServiceTest() { this.sessionFactory = new TestSessionFactory(this.DocumentStore); this.sut = new PostDataService(new Mock <ILog>().Object, this.sessionFactory, this.DocumentStore); }
public CategoryDataServiceTest() { this.sessionFactory = new TestSessionFactory(this.DocumentStore); this.sut = new CategoryDataService(new Mock<ILog>().Object, this.sessionFactory, this.DocumentStore); }