예제 #1
0
        public void CheckBaseImplementation()
        {
            MockDocumentTypeBase documentType = new MockDocumentTypeBase("RichText Documents", ".rtf");
            Assert.IsFalse(documentType.CanNew());
            Assert.IsFalse(documentType.CanOpen());
            Assert.IsFalse(documentType.CanSave(null));

            MockDocumentTypeBase documentType2 = new MockDocumentTypeBase("XPS Documents", ".xps");
            AssertHelper.ExpectedException<NotSupportedException>(() => documentType.New());
            AssertHelper.ExpectedException<NotSupportedException>(() => documentType.Open("TestDocument1.rtf"));
            AssertHelper.ExpectedException<NotSupportedException>(() => 
                documentType.Save(new DocumentBaseMock(documentType2), "TestDocument1.rtf"));

            AssertHelper.ExpectedException<ArgumentException>(() => documentType.Open(""));
            AssertHelper.ExpectedException<ArgumentException>(() => documentType.Save(new DocumentBaseMock(documentType2), ""));
            AssertHelper.ExpectedException<ArgumentNullException>(() => documentType.Save(null, "TestDocument1.rtf"));

            AssertHelper.ExpectedException<NotSupportedException>(() => documentType.CallNewCore());
            AssertHelper.ExpectedException<NotSupportedException>(() => documentType.CallOpenCore(null));
            AssertHelper.ExpectedException<NotSupportedException>(() => documentType.CallSaveCore(null, null));
        }
예제 #2
0
        public void CheckBaseImplementation()
        {
            MockDocumentTypeBase documentType = new MockDocumentTypeBase("RichText Documents", ".rtf");

            Assert.IsFalse(documentType.CanNew());
            Assert.IsFalse(documentType.CanOpen());
            Assert.IsFalse(documentType.CanSave(null));

            MockDocumentTypeBase documentType2 = new MockDocumentTypeBase("XPS Documents", ".xps");

            AssertHelper.ExpectedException <NotSupportedException>(() => documentType.New());
            AssertHelper.ExpectedException <NotSupportedException>(() => documentType.Open("TestDocument1.rtf"));
            AssertHelper.ExpectedException <NotSupportedException>(() =>
                                                                   documentType.Save(new DocumentBaseMock(documentType2), "TestDocument1.rtf"));

            AssertHelper.ExpectedException <ArgumentException>(() => documentType.Open(""));
            AssertHelper.ExpectedException <ArgumentException>(() => documentType.Save(new DocumentBaseMock(documentType2), ""));
            AssertHelper.ExpectedException <ArgumentNullException>(() => documentType.Save(null, "TestDocument1.rtf"));

            AssertHelper.ExpectedException <NotSupportedException>(() => documentType.CallNewCore());
            AssertHelper.ExpectedException <NotSupportedException>(() => documentType.CallOpenCore(null));
            AssertHelper.ExpectedException <NotSupportedException>(() => documentType.CallSaveCore(null, null));
        }
        public void CheckBaseImplementation()
        {
            MockDocumentTypeBase documentType = new MockDocumentTypeBase("FMStuido Solution Documents", ".fmsln");
            Assert.IsFalse(documentType.CanNew());
            Assert.IsFalse(documentType.CanOpen());
            Assert.IsFalse(documentType.CanSave(null));

            MockDocumentTypeBase documentType2 = new MockDocumentTypeBase("Financial Data Files", ".fdd");
            AssertHelper.ExpectedException<NotSupportedException>(() =>
                documentType.New(Path.Combine(Environment.CurrentDirectory, "TestDocument1")));
            AssertHelper.ExpectedException<NotSupportedException>(() => documentType.Open("TestDocument1.fdd"));
            AssertHelper.ExpectedException<NotSupportedException>(() =>
                documentType.Save(new DocumentBaseMock(documentType2), "TestDocument1.fdd"));

            AssertHelper.ExpectedException<ArgumentException>(() => documentType.Open(""));
            AssertHelper.ExpectedException<ArgumentException>(() =>
                documentType.Save(new DocumentBaseMock(documentType2), ""));
            AssertHelper.ExpectedException<ArgumentNullException>(() => documentType.Save(null, "TestDocument1.fdd"));

            AssertHelper.ExpectedException<NotSupportedException>(() => documentType.CallNewCore(null));
            AssertHelper.ExpectedException<NotSupportedException>(() => documentType.CallOpenCore(null));
            AssertHelper.ExpectedException<NotSupportedException>(() => documentType.CallSaveCore(null, null));
        }
예제 #4
0
 public DocumentBaseMock(MockDocumentTypeBase documentType)
     : base(documentType)
 {
 }
예제 #5
0
 public DocumentBaseMock(MockDocumentTypeBase documentType)
     : base(documentType)
 {
 }