public async Task <ActionResult> StartTestingAsync(UploadAssembilesModel files)
        {
            var assemblies = files.Assemblies
                             .Where(file => file.FileName.EndsWith(".dll"))
                             .Select(assemblyFile =>
            {
                Assembly assembly;
                using (var memoryStream = new MemoryStream())
                {
                    assemblyFile.CopyTo(memoryStream);
                    assembly = Assembly.Load(memoryStream.ToArray());
                }
                return(assembly);
            }).ToList();

            MyNUnitRunner.Run(assemblies, DynamicTestSubmission);

            foreach (KeyValuePair <string, TestedAssemblyModel> testedAssembly in MyNUnitRunner.AssemblyInformation)
            {
                await dbContext.Assemblys.AddAsync(testedAssembly.Value);
            }

            await dbContext.SaveChangesAsync();

            return(DynamicTestSubmission());
        }
 public void MenhodWithAttributesBeforeClassAndAfterClassTest()
 {
     Class8.array = new bool[] { false, false };
     MyNUnitRunner.Run("..\\..\\..\\..\\TestProjects\\ProjectForTest8");
     Assert.True(Class2.array[0]);
     Assert.True(Class2.array[1]);
 }
 public void SimpleWithAttributesBeforeAndAfterTest()
 {
     Class2.array = new bool[] { false, false, false, false };
     MyNUnitRunner.Run("..\\..\\..\\..\\TestProjects\\ProjectForTest2");
     Assert.True(Class2.array[0]);
     Assert.True(Class2.array[1]);
     Assert.False(Class2.array[2]);
     Assert.True(Class2.array[3]);
 }
 public void MethodWithAfterClassOrBeforeClassNotBeStaticTest()
 {
     Assert.Throws <AggregateException>(() => MyNUnitRunner.Run("..\\..\\..\\..\\TestProjects\\ProjectForTest9"));
 }
 public void MethodWithExpectedAnnotationsTest()
 {
     MyNUnitRunner.Run("..\\..\\..\\..\\TestProjects\\ProjectForTest7");
     Assert.True(typeof(NullReferenceException) == MyNUnitRunner.TestInformation.Take().Expected);
 }
 public void MethodWithParametersTest()
 {
     Assert.Throws <AggregateException>(() => MyNUnitRunner.Run("..\\..\\..\\..\\TestProjects\\ProjectForTest6"));
 }
 public void IgnoreAnnotationsMessageTest()
 {
     MyNUnitRunner.Run("..\\..\\..\\..\\TestProjects\\ProjectForTest4");
     Assert.Equal("just ignore", MyNUnitRunner.TestInformation.Take().Ignore);
 }
 public void IgnoreAnnotationsTest()
 {
     Class4.ignored = true;
     MyNUnitRunner.Run("..\\..\\..\\..\\TestProjects\\ProjectForTest4");
     Assert.True(Class4.ignored);
 }
 public void FailedDueToExceptionTest()
 {
     MyNUnitRunner.Run("..\\..\\..\\..\\TestProjects\\ProjectForTest3");
     Assert.False(MyNUnitRunner.TestInformation.Take().IsPassed);
 }
Ejemplo n.º 10
0
 public void WithoutOtherAttributesSimpleTest()
 {
     Class1.count = 8;
     MyNUnitRunner.Run("..\\..\\..\\..\\TestProjects\\ProjectForTest1");
     Assert.Equal(10, Class1.count);
 }