private static void Pause()
 {
     if (!StackTraceExtensions.IsStartedFromNCrunch())
     {
         Thread.Sleep(25);                 //ncrunch: no coverage
     }
 }
        public void CreateContentUploadQueue()
        {
            FileReader fileReader = StackTraceExtensions.IsStartedFromNCrunch()
                                ? new MockFileReader() : new FileReader();

            contentUploadQueue = new MockContentUploadQueue(fileReader,
                                                            (metaData, fileBytes) => uploadedContentFiles++);
        }
 //ncrunch: no coverage start
 protected ApproveFirstFrameScreenshot()
 {
     if (!StackTraceExtensions.IsStartedFromNCrunch() && StackTraceExtensions.IsUnitTest() &&
         ExcludeSharpDXAsScreenshotsCanOnlyBeMadeDelayed())
     {
         CheckApprovalImageAfterFirstFrame();
     }
 }
示例#4
0
 public ProjectCreatorViewModel(Service service)
 {
     this.service = service;
     this.service.DataReceived += OnDataReceived;
     project = new CsProject(service.UserName);
     AvailableStarterKits = VsTemplate.GetAllTemplateNames(project.Framework);
     AvailableFrameworks  = StackTraceExtensions.IsStartedFromNCrunch()
                         ? new FrameworkFinderSpy().All : new FrameworkFinder().All;
     RegisterCommands();
 }
        public void WindingOfVerticesShouldBeCounterClockWise()
        {
            if (!StackTraceExtensions.IsStartedFromNCrunch())
            {
                return;                 //ncrunch: no coverage
            }
            MockGeometry geometry = CreateMockGeometry();
            var          indices  = new short[] { 0, 1, 2 };

            geometry.SetData(CreateVertexData(), indices);
            AssertVertices(geometry, indices);
            AssertGeometryIsCounterClockWise(geometry);
        }
        public void WhenTwoServersExistMessagesAreSentToTheCorrectOne()
        {
            if (!StackTraceExtensions.IsStartedFromNCrunch())
            {
                return;                 //ncrunch: no coverage
            }
            MessagingSession serverSession2 = Messaging.StartSession(Port + 1);
            MessagingSession clientSession2 = Messaging.JoinSession(Address, Port + 1);

            clientSession.SendMessage("first");
            clientSession2.SendMessage("second");
            Assert.AreEqual("first", serverSession.GetMessages()[0].Data);
            Assert.AreEqual("second", serverSession2.GetMessages()[0].Data);
        }
 public void RegisterRenderableObject()
 {
     if (!StackTraceExtensions.IsStartedFromNCrunch())
     {
         return;
     }
     using (var device = new MockDevice(new MockWindow()))
     {
         device.Clear();
         device.Present();
         resolver.Register(device);
         resolver.RegisterSingleton <Drawing>();
         resolver.Register(new Line2D(Vector2D.One, Vector2D.Zero, Color.Red));
     }
 }
        public void WithTwoClientsWhenOneClientMessagesTheServerItIsEchoedToTheOtherClient()
        {
            if (!StackTraceExtensions.IsStartedFromNCrunch())
            {
                return;                 //ncrunch: no coverage
            }
            var clientSession2 = Messaging.JoinSession(Address, Port);

            clientSession2.SendMessage("welcome");
            List <MessagingSession.Message> messages = clientSession.GetMessages();

            Assert.AreEqual(1, serverSession.GetMessages().Count);
            Assert.AreEqual(1, messages.Count);
            VerifyMessageContents(messages[0], 2, "welcome");
            Assert.AreEqual(2, serverSession.NumberOfParticipants);
        }
示例#9
0
 private static string GetVisualStudioDocumentsFolder()
 {
     if (StackTraceExtensions.IsStartedFromNCrunch())
     {
         return(GetSupportedVisualStudioFolders()[0]);
     }
     //ncrunch: no coverage start
     foreach (var myVisualStudioDocuments in GetSupportedVisualStudioFolders())
     {
         if (Directory.Exists(myVisualStudioDocuments))
         {
             return(myVisualStudioDocuments);
         }
     }
     throw new VisualStudioDocumentsLocationNotFound();
     //ncrunch: no coverage end
 }
示例#10
0
        public void DrawAtlasSprite()
        {
            if (StackTraceExtensions.IsStartedFromNCrunch())
            {
                return;
            }
            // ncrunch: no coverage start
            //test: ContentLoader.Use<DiskContentLoader>();
            new FilledRect(Rectangle.HalfCentered, Color.Brown);
            var sprite1 = new Sprite("headPL", new Rectangle(0.25f, 0.25f, 0.5f, 0.25f));

            sprite1.UV    = new Rectangle(0, 0, 1, 0.5f);
            sprite1.Color = Color.Red;
            var sprite2 = new Sprite("headPL", new Rectangle(0.25f, 0.5f, 0.5f, 0.25f));

            sprite2.UV    = new Rectangle(0, 0.5f, 1, 0.5f);
            sprite2.Color = Color.Blue;
        }
示例#11
0
        //ncrunch: no coverage start
        protected virtual void CreateNewSourceCodeClass()
        {
            if (StackTraceExtensions.IsStartedFromNCrunch())
            {
                return;
            }
            string path      = service.GetAbsoluteSolutionFilePath(service.ProjectName);
            var    filePath  = Path.GetDirectoryName(path);
            bool   canCreate = true;

            if (File.Exists(filePath + "\\" + sceneClassName + ".cs"))
            {
                canCreate = GiveUserOptionOfOverwriting();
            }
            if (canCreate)
            {
                AddClassToProjectFileAndCsProj(filePath);
            }
        }
示例#12
0
 public void CreateParser()
 {
     parser = StackTraceExtensions.IsStartedFromNCrunch()
                         ? new MockProjectParser() : new ProjectParser();
 }