public void should_throw_if_SourceIntegrationItem_and_SourceIntegrationItemName_are_not_set() { // Arrange var processor = new ResolveExtension(); // Act Action action = () => processor.Process(new ProcessSharepointItemArgs()); // Assert action.ShouldThrow <InvalidOperationException>().WithMessage("args.SourceIntegrationItemName"); }
public void should_throw_if_args_is_not_set() { // Arrange var processor = new ResolveExtension(); // Act Action action = () => processor.Process(null); // Assert action.ShouldThrow <ArgumentException>().WithMessage("Value cannot be null.\r\nParameter name: args"); }
public void shold_do_noting_if_item_is_not_set() { // Arrange var args = new ProcessSharepointItemArgs { SourceIntegrationItemName = "some name" }; var processor = new ResolveExtension(); // Act processor.Process(args); // Assert args.SourceIntegrationItemName.Should().Be("some name"); }
public void should_respect_WhitespaceReplacement_setting(string itemName, string whitespaceReplacement, string expectedName) { using (new SettingsSwitcher("Media.IncludeExtensionsInItemNames", bool.TrueString)) using (new SettingsSwitcher("Media.WhitespaceReplacement", whitespaceReplacement)) { Item sourceItem = itemName.CreateIntegrationItem().WithField("Extension", "ext"); var args = new ProcessSharepointItemArgs { SourceIntegrationItemName = sourceItem.Name, SourceIntegrationItem = sourceItem, }; var processor = new ResolveExtension(); // Act processor.Process(args); // Assert args.SourceIntegrationItemName.Should().Be(expectedName); } }
public void should_fix_name_if_IncludeExtensionsInItemNames_is_enabled(string itemName, string extensions, string expectedName) { // Arrange using (new SettingsSwitcher("Media.IncludeExtensionsInItemNames", bool.TrueString)) { Item sourceItem = itemName.CreateIntegrationItem().WithField("Extension", extensions); var args = new ProcessSharepointItemArgs { SourceIntegrationItemName = sourceItem.Name, SourceIntegrationItem = sourceItem, }; var processor = new ResolveExtension(); // Act processor.Process(args); // Assert args.SourceIntegrationItemName.Should().Be(expectedName); } }