|
| 1 | +using System; |
| 2 | +using NUnit.Framework; |
| 3 | +using NetOffice.PowerPointApi; |
| 4 | +using System.IO; |
| 5 | + |
| 6 | +namespace NetOffice.Tests.PowerPointApi |
| 7 | +{ |
| 8 | + [TestFixture] |
| 9 | + [Category("IntegrationTests")] |
| 10 | + [Category("IntegrationTests_PowerPoint")] |
| 11 | + public class PresentationTests |
| 12 | + { |
| 13 | + public Application PowerPointApp { get; set; } |
| 14 | + public Documents Docs { get; set; } |
| 15 | + |
| 16 | + [SetUp] |
| 17 | + public void SetUp() |
| 18 | + { |
| 19 | + this.PowerPointApp = new Application(); |
| 20 | + this.Docs = new Documents(TestContext.CurrentContext); |
| 21 | + } |
| 22 | + |
| 23 | + [TearDown] |
| 24 | + public void TearDown() |
| 25 | + { |
| 26 | + this.PowerPointApp?.Quit(); |
| 27 | + this.PowerPointApp?.Dispose(); |
| 28 | + } |
| 29 | + |
| 30 | + [Test] |
| 31 | + public void AutoSaveOn_PresentationSavedLocally_FeatureAutoSaveIsOff_ReturnsFalse() |
| 32 | + { |
| 33 | + // Arrange |
| 34 | + var presentation = PowerPointApp.Presentations.Open(this.Docs.AutoSaveOn_PresentationSavedLocally_FeatureAutoSaveIsOff, false); |
| 35 | + |
| 36 | + // Act |
| 37 | + var actualValue = presentation.AutoSaveOn; |
| 38 | + |
| 39 | + // Assert |
| 40 | + Assert.IsFalse(actualValue); |
| 41 | + |
| 42 | + // Cleanup |
| 43 | + presentation.Close(); |
| 44 | + } |
| 45 | + |
| 46 | + [Test] |
| 47 | + public void AutoSaveOn_PresentationSavedInOneDrive_FeatureAutoSaveIsOn_ReturnsTrue() |
| 48 | + { |
| 49 | + // Arrange |
| 50 | + var presentation = PowerPointApp.Presentations.Open(this.Docs.AutoSaveOn_PresentationSavedInOneDrive_FeatureAutoSaveIsOn, false); |
| 51 | + |
| 52 | + // Act |
| 53 | + var actualValue = presentation.AutoSaveOn; |
| 54 | + |
| 55 | + // Assert |
| 56 | + Assert.IsTrue(actualValue); |
| 57 | + |
| 58 | + // Cleanup |
| 59 | + presentation.Close(); |
| 60 | + } |
| 61 | + |
| 62 | + public class Documents |
| 63 | + { |
| 64 | + public string AutoSaveOn_PresentationSavedLocally_FeatureAutoSaveIsOff { get; set; } |
| 65 | + public string AutoSaveOn_PresentationSavedInOneDrive_FeatureAutoSaveIsOn { get; set; } |
| 66 | + |
| 67 | + public Documents(TestContext context) |
| 68 | + { |
| 69 | + this.AutoSaveOn_PresentationSavedLocally_FeatureAutoSaveIsOff = Path.Combine(context.TestDirectory, @"PowerPointApi\Docs", "AutoSaveOn_PresentationSavedLocally_FeatureAutoSaveIsOff.pptx"); |
| 70 | + |
| 71 | + // Public link: https://1drv.ms/p/c/8cd14a64b99957bc/EVX1bUNmBtxDvfvg-aNQjKkBX35RJ3BJ6_2ey2Ox5gnIfA?e=DVyExX |
| 72 | + this.AutoSaveOn_PresentationSavedInOneDrive_FeatureAutoSaveIsOn = @"https://d.docs.live.net/8CD14A64B99957BC/Developer/NetOfficeFw/PowerPoint/AutoSaveOn_PresentationSavedInOneDrive_FeatureAutoSaveIsOn.pptx"; |
| 73 | + } |
| 74 | + } |
| 75 | + } |
| 76 | +} |
0 commit comments