Exemplo n.º 1
0
        public void GetNavigationDataShouldNotThrowOnMissingLineNumberField()
        {
            try
            {
                FileOperations.Initialize(
                    typeof(MockDiaSession).AssemblyQualifiedName,
                    typeof(MockDiaNavigationData2).AssemblyQualifiedName);
                var navigationData = new MockDiaNavigationData2()
                {
                    FileName = "mock"
                };
                MockDiaSession.DiaNavigationData = navigationData;

                var    diaSession = this.fileOperations.CreateNavigationSession(Assembly.GetExecutingAssembly().Location);
                int    minLineNumber;
                string fileName;
                this.fileOperations.GetNavigationData(
                    diaSession,
                    typeof(PortableFileOperationsTests).FullName,
                    "GetNavigationDataShouldReturnDataFromNavigationSession",
                    out minLineNumber,
                    out fileName);

                Assert.AreEqual(-1, minLineNumber);
                Assert.AreEqual(navigationData.FileName, fileName);
            }
            finally
            {
                MockDiaSession.Reset();
            }
        }
Exemplo n.º 2
0
        public void CreateNavigationSessionShuldReturnNullIfDiaSessionNotFound()
        {
            try
            {
                FileOperations.Initialize(string.Empty, string.Empty);

                Assert.IsNull(this.fileOperations.CreateNavigationSession(null));
                Assert.IsFalse(MockDiaSession.IsConstructorInvoked);
            }
            finally
            {
                MockDiaSession.Reset();
            }
        }
Exemplo n.º 3
0
        public void CreateNavigationSessionShouldReurnNullIfSourceIsNull()
        {
            try
            {
                FileOperations.Initialize(typeof(MockDiaSession).AssemblyQualifiedName, typeof(MockDiaNavigationData).AssemblyQualifiedName);

                Assert.IsNull(this.fileOperations.CreateNavigationSession(null));
                Assert.IsTrue(MockDiaSession.IsConstructorInvoked);
            }
            finally
            {
                MockDiaSession.Reset();
            }
        }
Exemplo n.º 4
0
        public void CreateNavigationSessionShouldReturnDiaSession()
        {
            try
            {
                FileOperations.Initialize(
                    typeof(MockDiaSession).AssemblyQualifiedName,
                    typeof(MockDiaNavigationData).AssemblyQualifiedName);

                var diaSession = this.fileOperations.CreateNavigationSession(Assembly.GetExecutingAssembly().Location);

                Assert.IsTrue(diaSession is MockDiaSession);
            }
            finally
            {
                MockDiaSession.Reset();
            }
        }