Ejemplo n.º 1
0
        public void ClosedDocument_AllPublicProperties_ShouldBeSettable()
        {
            var doc = new ClosedDocument();

            var props = doc.GetType().GetProperties();

            Assert.All(props, (p) => Assert.True(p.CanWrite));
        }
Ejemplo n.º 2
0
        public void ClosedDocument_Handle_InvalidPath(string path)
        {
            var doc = new ClosedDocument()
            {
                FullName = path
            };

            Assert.False(doc.IsValid());
        }
Ejemplo n.º 3
0
        public void ClosedDocument_ToString_Should_Contins_Data()
        {
            var doc = new ClosedDocument()
            {
                FullName = "c:\\test.cs",
                ClosedAt = DateTime.Now
            };

            var str = doc.ToString();

            Assert.Contains(doc.FullName, str);
            Assert.Contains(doc.ClosedAt.ToString(), str);
        }
        public void ItShould_Create_And_Execute_History_Command()
        {
            var doc = new ClosedDocument();
            var cmd = new OleMenuCommand(null, null);

            cmd.Properties.Add("HistoryItem", doc);
            _historyCommandFactoryMock.Setup(s => s.CreateCommand(It.Is <IClosedDocument[]>(p => p[0] == doc))).Returns(_historyCommandMock.Object);

            InvokeCommand(_documentsHistoryCommand, "DynamicCommandCallback", cmd);

            _historyCommandFactoryMock.Verify(v => v.CreateCommand(It.Is <IClosedDocument[]>(p => p[0] == doc)), Times.Once);
            _historyCommandMock.Verify(v => v.Execute(), Times.Once);
        }
Ejemplo n.º 5
0
        private void DocumentEventsOnDocumentClosing(EnvDTE.Document document)
        {
            if (SolutionState == SolutionStates.Opened)
            {
                var doc = new ClosedDocument()
                {
                    FullName = document.FullName,
                    Name     = document.Name,
                    Kind     = document.Kind,
                    Language = document.Language,
                    ClosedAt = DateTime.Now,
                };

                _documentHistoryManager.Add(doc);
            }
        }