//TODO test different formatting options: unicode, octobraille, nacb where applicable

        public byte[] TestBrailleAPI(string language, string format, int charsPerLine, int linesPerPage, string contraction, int dots)
        {
            Encoding enc             = RoboBrailleProcessor.GetEncodingByCountryCode((Language)Enum.Parse(typeof(Language), language, true));
            var      apiFileContents = enc.GetBytes(IOController.GetTestForLanguage(language));

            PageNumbering pn = PageNumbering.none;

            var brj = new BrailleJob()
            {
                Id                = Guid.NewGuid(),
                FileContent       = apiFileContents,
                UserId            = Guid.Parse("d2b97532-e8c5-e411-8270-f0def103cfd0"),
                FileExtension     = ".txt",
                FileName          = "testBraille",
                MimeType          = "plaint/text",
                Status            = JobStatus.Started,
                SubmitTime        = DateTime.Now,
                DownloadCounter   = 0,
                InputFileHash     = RoboBrailleProcessor.GetMD5Hash(apiFileContents),
                BrailleLanguage   = (Language)Enum.Parse(typeof(Language), language, true),
                BrailleFormat     = (BrailleFormat)Enum.Parse(typeof(BrailleFormat), dots.ToString(), true),
                CharactersPerLine = charsPerLine,
                LinesPerPage      = linesPerPage,
                Contraction       = (BrailleContraction)Enum.Parse(typeof(BrailleContraction), contraction, true),
                ConversionPath    = ConversionPath.texttobraille,
                OutputFormat      = (OutputFormat)Enum.Parse(typeof(OutputFormat), format, true),
                PageNumbering     = pn
            };

            var apiTask = Task.Run(() => WebAPICall(brj));

            byte[] apiRes = apiTask.Result;
            return(apiRes);
        }
        public void TestEbookDocxEpub3()
        {
            RabbitMQCluster.ClusterConnect();
            var testDocumentsName = "A1.Daisy.docx";
            var apiFileContent    = inputFiles.Where(x => x.Key.EndsWith(testDocumentsName)).Select(x => x.Value).First();
            var ebookj            = new DaisyJob()
            {
                Id              = Guid.NewGuid(),
                FileContent     = apiFileContent,
                UserId          = Guid.Parse("d2b97532-e8c5-e411-8270-f0def103cfd0"),
                FileExtension   = ".docx",
                FileName        = "testDaisyEPUB3WMO",
                MimeType        = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
                Status          = JobStatus.Started,
                SubmitTime      = DateTime.Now,
                DownloadCounter = 0,
                InputFileHash   = RoboBrailleProcessor.GetMD5Hash(apiFileContent),
                DaisyOutput     = DaisyOutput.Epub3WMO
            };

            var apiTask = Task.Run(() => WebAPICall(ebookj));

            byte[] apiRes = apiTask.Result;

            //assert
            NUnit.Framework.Assert.IsNotEmpty(apiRes);
            IOController.SaveTestResultFile(apiRes, "Ebook-" + timestamp + "-EPUB3WMO-API.epub");

            RabbitMQCluster.ClusterDisconnect();
        }
Ejemplo n.º 3
0
        public void TestDaisyDocx()
        {
            //arrange
            var testDocumentsName = "A1.Daisy.docx";
            var apiFileContent    = inputFiles.Where(x => x.Key.EndsWith(testDocumentsName)).Select(x => x.Value).First();

            DaisyJob daisyj = new DaisyJob()
            {
                Id              = Guid.NewGuid(),
                FileContent     = apiFileContent,
                UserId          = Guid.Parse("d2b97532-e8c5-e411-8270-f0def103cfd0"),
                FileExtension   = ".docx",
                FileName        = "testDaisy",
                MimeType        = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
                Status          = JobStatus.Started,
                SubmitTime      = DateTime.Now,
                DownloadCounter = 0,
                InputFileHash   = RoboBrailleProcessor.GetMD5Hash(apiFileContent),
                DaisyOutput     = DaisyOutput.TalkingBook
            };


            //act
            var apiTask = Task.Run(() => WebAPICall(daisyj));

            byte[] apiRes = apiTask.Result;

            //assert
            NUnit.Framework.Assert.IsNotEmpty(apiRes);
            IOController.SaveTestResultFile(apiRes, "Daisy-" + timestamp + "-API.zip");
        }
        public byte[] TestAudioAPI(string language, List <VoicePropriety> voicepropriety, string age = "", string gender = "", AudioSpeed audioSpeed = AudioSpeed.Normal, AudioFormat audioFormat = AudioFormat.Mp3)
        {
            var      outputPath = IOController.GetOutputDirectory();
            Language lang       = Language.enGB;

            byte[] apiFileContent = null;
            if (Enum.IsDefined(typeof(Language), language.Substring(0, 4)))
            {
                apiFileContent = RoboBrailleProcessor.GetEncodingByCountryCode(lang).GetBytes(IOController.GetTestForLanguage(language));
                lang           = (Language)Enum.Parse(typeof(Language), language.Substring(0, 4), true);
            }
            var voiceProps = new List <VoicePropriety>();

            if (age.Equals("Young"))
            {
                voiceProps.Add(VoicePropriety.Younger);
            }
            if (age.Equals("Old"))
            {
                voiceProps.Add(VoicePropriety.Older);
            }
            if (gender.Equals("Male"))
            {
                voiceProps.Add(VoicePropriety.Male);
            }
            if (gender.Equals("Female"))
            {
                voiceProps.Add(VoicePropriety.Female);
            }
            if (voicepropriety != null)
            {
                voiceProps.AddRange(voicepropriety);
            }
            AudioJob auj = new AudioJob()
            {
                Id              = Guid.NewGuid(),
                FileContent     = apiFileContent,
                UserId          = Guid.Parse("d2b97532-e8c5-e411-8270-f0def103cfd0"),
                FileExtension   = "" + ".mp3",
                FileName        = "testAudio",
                MimeType        = "plain/text",
                Status          = JobStatus.Started,
                SubmitTime      = DateTime.Now,
                DownloadCounter = 0,
                InputFileHash   = RoboBrailleProcessor.GetMD5Hash(apiFileContent),
                AudioLanguage   = lang,
                FormatOptions   = audioFormat,
                SpeedOptions    = audioSpeed,
                VoicePropriety  = voiceProps.ToArray()
            };

            return(WebAPICall(auj).Result);
        }
        public void TestEbookPdfEpub()
        {
            //arrange
            string format            = "EPUB";
            string testDocumentsName = "A6.1.testTaggedPDF.pdf";

            //act
            var apiRes = TestEbookAPI(format, testDocumentsName);

            //assert
            NUnit.Framework.Assert.IsNotEmpty(apiRes);
            IOController.SaveTestResultFile(apiRes, "Ebook-" + timestamp + "-Pdf-" + format + "-API." + format.ToLowerInvariant());
        }
        public void TestEbookHtmlMobi()
        {
            //arrange
            string format            = "MOBI";
            string testDocumentsName = "A4.testHTMLtotext.html";

            //act
            var apiRes = TestEbookAPI(format, testDocumentsName);

            //assert
            NUnit.Framework.Assert.IsNotEmpty(apiRes);
            IOController.SaveTestResultFile(apiRes, "Ebook-" + timestamp + "-Html-" + format + "-API." + format.ToLowerInvariant());
        }
        public void TestEbookEpubTxt()
        {
            //arrange
            string format            = "txt";
            string testDocumentsName = "A25.testEpub.epub";

            //act
            var apiRes = TestEbookAPI(format, testDocumentsName);

            //assert
            NUnit.Framework.Assert.IsNotEmpty(apiRes);
            IOController.SaveTestResultFile(apiRes, "Ebook-" + timestamp + "-Epub-" + format + "-API." + format.ToLowerInvariant());
        }
        public void TestEbookDocxMobi()
        {
            //arrange
            string format            = "MOBI";
            string testDocumentsName = "A12testWordComplete.docx";

            //act
            var apiRes = TestEbookAPI(format, testDocumentsName);

            //assert
            NUnit.Framework.Assert.IsNotEmpty(apiRes);
            IOController.SaveTestResultFile(apiRes, "Ebook-" + timestamp + "-Docx-" + format + "-API." + format.ToLowerInvariant());
        }
        public void TestBrailleEnGB6G2()
        {
            string language = "enGB";
            string contraction = "grade2";
            string format = "none";
            int    charsPerLine = 0, linesPerPage = 0;
            int    dots   = 6;
            var    apiRes = TestBrailleAPI(language, format, charsPerLine, linesPerPage, contraction, dots);

            NUnit.Framework.Assert.IsNotNull(apiRes);
            Assert.IsNotEmpty(apiRes);
            IOController.SaveTestResultFile(apiRes, "Braille-" + timestamp + "-" + language + "-" + contraction + "-" + format + "-" + dots + "-API.txt");
        }
        public void TestBrailleDanish8LargeOcto()
        {
            string language = "daDK";
            string contraction = "large";
            string format = "octobraille";
            int    charsPerLine = 0, linesPerPage = 0;
            int    dots   = 8;
            var    apiRes = TestBrailleAPI(language, format, charsPerLine, linesPerPage, contraction, dots);

            NUnit.Framework.Assert.IsNotNull(apiRes);
            Assert.IsNotEmpty(apiRes);
            IOController.SaveTestResultFile(apiRes, "Braille-" + timestamp + "-" + language + "-" + contraction + "-" + format + "-" + dots + "-API.txt");
        }
Ejemplo n.º 11
0
        public void TestAccessibilityPdfToDocx()
        {
            //arrange
            string format   = "docx";
            string fileName = "A6.testPDF.pdf";

            //act
            var apiRes = TestAccessibilityAPI(format, fileName);

            //assert and save to result dir
            NUnit.Framework.Assert.IsNotEmpty(apiRes);
            IOController.SaveTestResultFile(apiRes, "AccessibilityPdf-" + timestamp + "-" + format + "-API." + format);
        }
        public void TestCerthOcrPdfToHtml()
        {
            //arrange
            string format   = "html";
            string fileName = "A6.testPDF.pdf";

            //act
            var apiRes = TestCerthOcrAPI(true, fileName);

            //assert and save to result dir
            NUnit.Framework.Assert.IsNotEmpty(apiRes);
            IOController.SaveTestResultFile(apiRes, "CerthOcrPdf-" + timestamp + "-" + format + "-API." + format);
        }
        public void TestAudioWelshMale()
        {
            //arrange
            string language = Language.cyGB.ToString();
            string age      = "";
            string gender   = "Male";
            //act
            var apiRes = TestAudioAPI(language, null, age, gender);

            //assert
            Assert.IsNotNull(apiRes);
            IOController.SaveTestResultFile(apiRes, "Audio-" + timestamp + "-" + language + "-" + age + "-" + gender + "-API" + ".mp3");
        }
Ejemplo n.º 14
0
        public void TestAccessibilityScanPdfToTaggedPdf()
        {
            //arrange
            string format   = "pdf";
            string fileName = "A28.testScanDoc.pdf";

            //act
            var apiRes = TestAccessibilityAPI(format, fileName);

            //assert and save to result dir
            NUnit.Framework.Assert.IsNotEmpty(apiRes);
            IOController.SaveTestResultFile(apiRes, "AccessibilityPdf-" + timestamp + "-" + format + "-API." + format.Substring(0, 3));
        }
        public void TestAudioEnUSModeratelyFast()
        {
            //arrange
            string language = Language.enUS.ToString();
            string age      = "";
            string gender   = "";
            //act
            var apiRes = TestAudioAPI(language, null, age, gender, AudioSpeed.ModerateFast);

            //assert
            Assert.IsNotNull(apiRes);
            IOController.SaveTestResultFile(apiRes, "Audio-" + timestamp + "-" + language + "-" + age + "-" + gender + "-Faster-API" + ".mp3");
        }
Ejemplo n.º 16
0
        public void TestAccessibilityImageToHtm()
        {
            //arrange
            string format   = "htm";
            string fileName = "A27.testTableImage.png";

            //act
            var apiRes = TestAccessibilityAPI(format, fileName);

            //assert and save to result dir
            NUnit.Framework.Assert.IsNotEmpty(apiRes);
            IOController.SaveTestResultFile(apiRes, "AccessibilityImage-" + timestamp + "-" + format + "-API." + format);
        }
        public void TestAudioLithuanianFemaleOlder()
        {
            //arrange
            string language = Language.ltLT.ToString();
            string age      = "Old";
            string gender   = "Female";
            //act
            var apiRes = TestAudioAPI(language, null, age, gender);

            //assert
            Assert.IsNotNull(apiRes);
            IOController.SaveTestResultFile(apiRes, "Audio-" + timestamp + "-" + language + "-" + age + "-" + gender + "-API" + ".mp3");
        }
Ejemplo n.º 18
0
        public void TestAccessibilityJpgToText()
        {
            //arrange
            string format   = "txt";
            string fileName = "A17.testOcr.jpg";

            //act
            var apiRes = TestAccessibilityAPI(format, fileName);

            //assert and save to result dir
            NUnit.Framework.Assert.IsNotEmpty(apiRes);
            IOController.SaveTestResultFile(apiRes, "AccessibilityImageJpg-" + timestamp + "-" + format + "-API." + format);
        }
Ejemplo n.º 19
0
        public void TestHtmlToTextTable()
        {
            //arrange
            string format   = "txt";
            string fileName = "A3.testHTMLtable.html";

            //act
            var apiRes = TestAPI(fileName);

            //assert and save to result dir
            NUnit.Framework.Assert.IsNotEmpty(apiRes);
            IOController.SaveTestResultFile(apiRes, "HtmlToTextTable-" + timestamp + "-API." + format);
        }
        public void TestAudioEnUSAAC()
        {
            //arrange
            string language = Language.enUS.ToString();
            string age      = "";
            string gender   = "";
            //act
            var apiRes = TestAudioAPI(language, null, age, gender, AudioSpeed.Normal, AudioFormat.Aac);

            //assert
            Assert.IsNotNull(apiRes);
            IOController.SaveTestResultFile(apiRes, "Audio-" + timestamp + "-" + language + "-" + age + "-" + gender + "-aac-API" + ".mp3");
        }
        public void TestAudioEnGBSpacedText()
        {
            //arrange
            string file     = "A30.testSpacedTextEN.txt";
            string language = "enGB";
            string age      = "";
            string gender   = "Female";
            //act
            var apiRes = TestAudioAPIFile(file, language, age, gender);

            //assert
            Assert.IsNotNull(apiRes);
            IOController.SaveTestResultFile(apiRes, "Audio-" + timestamp + "-" + language + "-" + age + "-" + gender + "-API" + "-Spaced.mp3");
        }
        //takes 12 minutes
        //[Test]
        public void TestAudioDanishFemaleSaraLargeText()
        {
            //arrange
            string file     = "A29.testLargeTextDK.txt";
            string language = "daDK";
            string age      = "";
            string gender   = "Female";
            //act
            var apiRes = TestAudioAPIFile(file, language, age, gender);

            //assert
            Assert.IsNotNull(apiRes);
            IOController.SaveTestResultFile(apiRes, "Audio-" + timestamp + "-" + language + "-" + age + "-" + gender + "-API" + "-Large.mp3");
        }
        public void TestAudioArabic()
        {
            throw new NotImplementedException("Voice not installed");
            //arrange
            string language = Language.arEG.ToString();
            string age      = "";
            string gender   = "";
            //act
            var apiRes = TestAudioAPI(language, null, age, gender);

            //assert
            Assert.IsNotNull(apiRes);
            IOController.SaveTestResultFile(apiRes, "Audio-" + timestamp + "-" + language + "-" + age + "-" + gender + "-API" + ".mp3");
        }
        public void TestAudioRussian()
        {
            //arrange
            string language = Language.ruRU.ToString();
            string age      = "";
            string gender   = "";
            //act
            var apiRes = TestAudioAPI(language, null, age, gender);

            //var ftpRes = GetAudioGroundTruth(language, null, age, gender);
            //assert
            Assert.IsNotNull(apiRes);
            IOController.SaveTestResultFile(apiRes, "Audio-" + timestamp + "-" + language + "-" + age + "-" + gender + "-API" + ".mp3");
            //Assert.IsNotNull(ftpRes);
            //IOController.SaveTestResultFile(ftpRes, "Audio-" + timestamp + "-" + language + "-" + age + "-" + gender + "-FTP" + ".mp3");
            //Assert.AreEqual(RoboBrailleProcessor.GetMD5Hash(ftpRes), RoboBrailleProcessor.GetMD5Hash(apiRes));
        }
        public void TestAudioArabicEnglish()
        {
            throw new NotImplementedException("Voice not installed");
            //arrange
            string language = Language.arEG.ToString();
            string age      = "";
            string gender   = "";
            List <VoicePropriety> properties = new List <VoicePropriety>()
            {
                VoicePropriety.Bilingual
            };
            //act
            var apiRes = TestAudioAPI(language, properties, age, gender);

            //assert
            Assert.IsNotNull(apiRes);
            IOController.SaveTestResultFile(apiRes, "Audio-" + timestamp + "-" + language + "-" + VoicePropriety.Bilingual + "-" + gender + "-API" + ".mp3");
        }
Ejemplo n.º 26
0
 public void Initialize()
 {
     inputFiles = IOController.GetInputFiles();
     RabbitMQCluster.ClusterConnect();
 }
Ejemplo n.º 27
0
 public void Initialize()
 {
     inputFiles = IOController.GetInputFiles();
 }
        public async Task TestPostAccessibleConversion()
        {
            //init
            var mockJobs         = new Mock <DbSet <Job> >();
            var mockServiceUsers = new Mock <DbSet <ServiceUser> >();
            var mockContext      = new Mock <RoboBrailleDataContext>();

            // arrange
            var users = new List <ServiceUser> {
                new ServiceUser
                {
                    EmailAddress = "*****@*****.**",
                    UserId       = Guid.Parse("d2b97532-e8c5-e411-8270-f0def103cfd0"),
                    ApiKey       = Encoding.UTF8.GetBytes("7b76ae41-def3-e411-8030-0c8bfd2336cd"),
                    FromDate     = new DateTime(2015, 1, 1),
                    ToDate       = new DateTime(2020, 1, 1),
                    UserName     = "******",
                    Jobs         = null
                }
            }.AsQueryable();

            AccessibleConversionJob acj = new AccessibleConversionJob()
            {
                Id                   = Guid.NewGuid(),
                FileContent          = File.ReadAllBytes(IOController.GetInputFiles().Where(x => x.Key.EndsWith("A6.testPDF.pdf")).Select(x => x.Key).First()),
                TargetDocumentFormat = OutputFileFormatEnum.OFF_DOCX,
                UserId               = Guid.Parse("d2b97532-e8c5-e411-8270-f0def103cfd0"),
                FileExtension        = ".pdf",
                FileName             = "test",
                MimeType             = "application/pdf",
                Status               = JobStatus.Started,
                SubmitTime           = DateTime.Now,
                DownloadCounter      = 0,
                InputFileHash        = new byte[8]
            };
            AccessibleConversionJob acj2 = new AccessibleConversionJob()
            {
                Id                   = Guid.NewGuid(),
                FileContent          = File.ReadAllBytes(IOController.GetInputFiles().Where(x => x.Key.EndsWith("A6.testPDF.pdf")).Select(x => x.Key).First()),
                TargetDocumentFormat = OutputFileFormatEnum.OFF_PDF,
                UserId               = Guid.Parse("d2b87532-e8c5-e411-8270-f0def103cfd0"),
                FileExtension        = ".txt",
                FileName             = "test2",
                MimeType             = "text/plain",
                Status               = JobStatus.Done,
                SubmitTime           = DateTime.Now,
                DownloadCounter      = 2,
                InputFileHash        = new byte[2]
            };
            var jobs = new List <AccessibleConversionJob> {
                acj2
            }.AsQueryable();

            mockJobs.As <IDbAsyncEnumerable <Job> >().Setup(m => m.GetAsyncEnumerator()).Returns(new TestDbAsyncEnumerator <Job>(jobs.GetEnumerator()));
            mockJobs.As <IQueryable <Job> >().Setup(m => m.Provider).Returns(new TestDbAsyncQueryProvider <Job>(jobs.Provider));

            mockJobs.As <IQueryable <Job> >().Setup(m => m.Expression).Returns(jobs.Expression);
            mockJobs.As <IQueryable <Job> >().Setup(m => m.ElementType).Returns(jobs.ElementType);
            mockJobs.As <IQueryable <Job> >().Setup(m => m.GetEnumerator()).Returns(jobs.GetEnumerator());

            mockServiceUsers.As <IDbAsyncEnumerable <ServiceUser> >().Setup(m => m.GetAsyncEnumerator()).Returns(new TestDbAsyncEnumerator <ServiceUser>(users.GetEnumerator()));
            mockServiceUsers.As <IQueryable <ServiceUser> >().Setup(m => m.Provider).Returns(new TestDbAsyncQueryProvider <ServiceUser>(users.Provider));
            mockServiceUsers.As <IQueryable <ServiceUser> >().Setup(m => m.Expression).Returns(users.Expression);
            mockServiceUsers.As <IQueryable <ServiceUser> >().Setup(m => m.ElementType).Returns(users.ElementType);
            mockServiceUsers.As <IQueryable <ServiceUser> >().Setup(m => m.GetEnumerator()).Returns(users.GetEnumerator());

            mockContext.Setup(m => m.Jobs).Returns(mockJobs.Object);
            mockContext.Setup(m => m.ServiceUsers).Returns(mockServiceUsers.Object);

            var repo    = new AccessibleConversionRepository(mockContext.Object);
            var request = new HttpRequestMessage();

            request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Authorization", "Hawk id=\"d2b97532-e8c5-e411-8270-f0def103cfd0\", ts=\"1470657024\", nonce=\"VkcMGB\", mac=\"hXW+BLRoqwlUaQZQtpPToOWnVAh5KbAXGGT5f8dLMVk=\"");
            var serviceController = new AccessibleConversionController(repo)
            {
                Request = request
            };
            //call
            var res = serviceController.Post(acj).Result;

            //test

            mockJobs.Verify(m => m.Add(It.IsAny <Job>()), Times.Once());
            mockContext.Verify(m => m.SaveChanges(), Times.Exactly(1));
            //twice if it is synced
            //mockContext.Verify(m => m.SaveChanges(), Times.Exactly(2));
        }
Ejemplo n.º 29
0
        public async Task TestPostMSOfficeConversion()
        {
            //init
            var mockJobs         = new Mock <DbSet <Job> >();
            var mockServiceUsers = new Mock <DbSet <ServiceUser> >();
            var mockContext      = new Mock <RoboBrailleDataContext>();

            // arrange
            var users = new List <ServiceUser> {
                new ServiceUser
                {
                    EmailAddress = "*****@*****.**",
                    UserId       = Guid.Parse("d2b97532-e8c5-e411-8270-f0def103cfd0"),
                    ApiKey       = Encoding.UTF8.GetBytes("7b76ae41-def3-e411-8030-0c8bfd2336cd"),
                    FromDate     = new DateTime(2015, 1, 1),
                    ToDate       = new DateTime(2020, 1, 1),
                    UserName     = "******",
                    Jobs         = null
                }
            }.AsQueryable();

            MSOfficeJob moj = new MSOfficeJob()
            {
                Id              = Guid.NewGuid(),
                FileContent     = File.ReadAllBytes(IOController.GetInputFiles().Where(x => x.Key.EndsWith("A13.testWordSimplified.docx")).Select(x => x.Key).First()),
                UserId          = Guid.Parse("d2b97532-e8c5-e411-8270-f0def103cfd0"),
                FileExtension   = "docx",
                FileName        = "test",
                MimeType        = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
                Status          = JobStatus.Started,
                SubmitTime      = DateTime.Now,
                DownloadCounter = 0,
                InputFileHash   = new byte[8],
                MSOfficeOutput  = MSOfficeOutput.html
            };
            MSOfficeJob moj2 = new MSOfficeJob()
            {
                Id              = Guid.NewGuid(),
                FileContent     = new byte[256],
                UserId          = Guid.Parse("d2b87532-e8c5-e411-8270-f0def103cfd0"),
                FileExtension   = ".txt",
                FileName        = "test2",
                MimeType        = "text/plain",
                Status          = JobStatus.Done,
                SubmitTime      = DateTime.Now,
                DownloadCounter = 2,
                InputFileHash   = new byte[2]
            };
            var jobs = new List <MSOfficeJob> {
                moj2
            }.AsQueryable();

            mockJobs.As <IDbAsyncEnumerable <Job> >().Setup(m => m.GetAsyncEnumerator()).Returns(new TestDbAsyncEnumerator <Job>(jobs.GetEnumerator()));
            mockJobs.As <IQueryable <Job> >().Setup(m => m.Provider).Returns(new TestDbAsyncQueryProvider <Job>(jobs.Provider));

            mockJobs.As <IQueryable <Job> >().Setup(m => m.Expression).Returns(jobs.Expression);
            mockJobs.As <IQueryable <Job> >().Setup(m => m.ElementType).Returns(jobs.ElementType);
            mockJobs.As <IQueryable <Job> >().Setup(m => m.GetEnumerator()).Returns(jobs.GetEnumerator());

            mockServiceUsers.As <IDbAsyncEnumerable <ServiceUser> >().Setup(m => m.GetAsyncEnumerator()).Returns(new TestDbAsyncEnumerator <ServiceUser>(users.GetEnumerator()));
            mockServiceUsers.As <IQueryable <ServiceUser> >().Setup(m => m.Provider).Returns(new TestDbAsyncQueryProvider <ServiceUser>(users.Provider));
            mockServiceUsers.As <IQueryable <ServiceUser> >().Setup(m => m.Expression).Returns(users.Expression);
            mockServiceUsers.As <IQueryable <ServiceUser> >().Setup(m => m.ElementType).Returns(users.ElementType);
            mockServiceUsers.As <IQueryable <ServiceUser> >().Setup(m => m.GetEnumerator()).Returns(users.GetEnumerator());

            mockContext.Setup(m => m.Jobs).Returns(mockJobs.Object);
            mockContext.Setup(m => m.ServiceUsers).Returns(mockServiceUsers.Object);

            //TODO refine the call to various libs to be more similar

            //TODO look at the code coverage to cover more code
            //TODO Test and call all possible paths through code mock the interfaces to various libs (not necessarily that important)
            var repo    = new MSOfficeRepository(mockContext.Object);
            var request = new HttpRequestMessage();

            request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Authorization", "Hawk id=\"d2b97532-e8c5-e411-8270-f0def103cfd0\", ts=\"1470657024\", nonce=\"VkcMGB\", mac=\"hXW+BLRoqwlUaQZQtpPToOWnVAh5KbAXGGT5f8dLMVk=\"");
            var serviceController = new MSOfficeConversionController(repo);

            serviceController.Request = request;
            //call
            await serviceController.Post(moj);

            //test
            mockJobs.Verify(m => m.Add(It.IsAny <Job>()), Times.Once());

            mockContext.Verify(m => m.SaveChanges(), Times.Exactly(1));
            //twice if it is synced
            //mockContext.Verify(m => m.SaveChanges(), Times.Exactly(2));
        }