GivenTaskWithItemId_Title_Description_Folder_And_Visibility__WhenRunningTask__ShouldPublishWithSettings() { WorkshopItemSpy workshopItemSpy = new WorkshopItemSpy(); SteamWorkshopSpy workshopSpy = new SteamWorkshopSpy { WorkshopItemsById = { { ItemId, workshopItemSpy } } }; UpdateSteamWorkshopItemTask sut = new UpdateSteamWorkshopItemTask(workshopSpy) { AppId = AppId, ItemId = ItemId, ChangeSet = new WorkshopItemChangeSetStub { ChangeSetValidationResult = (true, null), Title = Title, DescriptionFilePath = DescriptionFilePath, ItemFolderPath = ExpectedDirectoryName, Visibility = WorkshopItemVisibility.Public, Tags = ExpectedTags } }; sut.Run(); IWorkshopItemChangeSet actual = workshopItemSpy.ReceivedSettings; Assert.AreEqual(AppId, workshopSpy.AppId); Assert.AreEqual(Title, actual.Title); Assert.AreEqual(DescriptionFilePath, actual.DescriptionFilePath); Assert.AreEqual(WorkshopItemVisibility.Public, actual.Visibility); Assert.AreEqual(ExpectedDirectoryName, actual.ItemFolderPath); Assert.AreEqual(ExpectedTags, actual.Tags); }
public void GivenTaskWithInvalidNewChangeSet__WhenRunningTask__ShouldThrowExceptionFromChangeSet() { WorkshopItemSpy workshopItemSpy = new WorkshopItemSpy(); SteamWorkshopStub workshopStub = new SteamWorkshopStub { WorkshopItemsById = { { ItemId, workshopItemSpy } } }; UpdateSteamWorkshopItemTask sut = new UpdateSteamWorkshopItemTask(workshopStub) { AppId = AppId, ItemId = ItemId, ChangeSet = new WorkshopItemChangeSetStub { ChangeSetValidationResult = (false, new FormatException()) } }; Action actual = () => sut.Run(); Assert.ThrowsException <FormatException>(actual); }