Skip to content

Commit 1011d7b

Browse files
committed
Add integration test for presentation saved locally and with Auto Save feature disabled
1 parent be5c3e4 commit 1011d7b

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

Source/NetOffice.Tests/NetOffice.Tests.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,12 @@
4242
<EmbeddedResource Include="Data\SampleImage.png" />
4343
<EmbeddedResource Include="Data\SampleText.txt" />
4444
</ItemGroup>
45+
<ItemGroup>
46+
<Folder Include="PowerPointApi\Docs\" />
47+
</ItemGroup>
48+
<ItemGroup>
49+
<None Update="PowerPointApi\Docs\AutoSaveOn_PresentationSavedLocally_FeatureAutoSaveIsOff.pptx">
50+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
51+
</None>
52+
</ItemGroup>
4553
</Project>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
43+
public class Documents
44+
{
45+
public string AutoSaveOn_PresentationSavedLocally_FeatureAutoSaveIsOff { get; set; }
46+
47+
public Documents(TestContext context)
48+
{
49+
this.AutoSaveOn_PresentationSavedLocally_FeatureAutoSaveIsOff = Path.Combine(context.TestDirectory, @"PowerPointApi\Docs", "AutoSaveOn_PresentationSavedLocally_FeatureAutoSaveIsOff.pptx");
50+
}
51+
}
52+
}
53+
}

0 commit comments

Comments
 (0)