public void SingleParse_PassName_ShouldSetNameOnProperty() { var name = Guid.NewGuid().ToString("N"); var task = InlineSheetExportTask <SomeEntityModel, SomeRowData> .SingleParse(name, EmptyAsyncEnumerable <SomeEntityModel>, _ => new SomeRowData()); Assert.That(task.Name, Is.EqualTo(name)); }
public void SingleParse_InvalidArguments_ShouldThrowException() { ArgumentException ex = Assert.Throws <ArgumentNullException>(() => InlineSheetExportTask <SomeEntityModel, SomeRowData> .SingleParse(null, EmptyAsyncEnumerable <SomeEntityModel>, _ => new SomeRowData())); Assert.That(ex.ParamName, Is.EqualTo("name")); ex = Assert.Throws <ArgumentNullException>(() => InlineSheetExportTask <SomeEntityModel, SomeRowData> .SingleParse(string.Empty, EmptyAsyncEnumerable <SomeEntityModel>, _ => new SomeRowData())); Assert.That(ex.ParamName, Is.EqualTo("name")); ex = Assert.Throws <ArgumentNullException>(() => InlineSheetExportTask <SomeEntityModel, SomeRowData> .SingleParse("SomeName", null, _ => new SomeRowData())); Assert.That(ex.ParamName, Is.EqualTo("fetchEntities")); ex = Assert.Throws <ArgumentNullException>(() => InlineSheetExportTask <SomeEntityModel, SomeRowData> .SingleParse("SomeName", EmptyAsyncEnumerable <SomeEntityModel>, null)); Assert.That(ex.ParamName, Is.EqualTo("parseEntity")); }