Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Testing - open a testing workbook

Aperta
#10 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
csharp

Direzione di ricerca

Inizia con la WorkbookFixture proposta nell’assembly ExcelDna.Testing ed esamina le cartelle di lavoro di XFunctions Examples, in particolare HelpExamples.xlsx. Esamina come xUnit IClassFixture dovrebbe fornire la cartella di lavoro, quindi risolvi le questioni aperte dell’issue relative all’individuazione, all’apertura e alla chiusura delle cartelle di lavoro di test. Il lavoro è completato quando è definito un design del fixture che supporta l’esecuzione dei test su una cartella di lavoro precreata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I think it would be nice to be able to run all the test from a class in the context of a pre-created workbook.
I'm trying to understand what the xUnit way to set this up would be.

For example, in the XFunctions add-in, I have some example workbooks:
https://github.com/Excel-DNA/XFunctions/tree/master/Examples
I want to make tests for the XFunctions add-in that execute in the context of one of those workbooks.

I suggest we add a WorkbookFixture class in the ExcelDna.Testing assembly that looks like this:

public class WorkbookFixture : IDisposable
{
    public Workbook Workbook { get; }

    public WorkbookFixture(string name)
    {
        // Look for the workbook in the test directory or somewhere close
        // not sure what the path search story should be - do we allow partial paths like testbook/myBook.xlsx ?
        // in practise one might want the test workbook in the test project directory, not the test output directory?
        // Anyway, once we've found it we open it.
    }
    public Dispose() {  // Close it? } 
}

For the test code, maybe something like this could then work.

Suppose there is a file called HelpExamples.xlsx in a good directory.
Then the test gets a class that subclasses the WorkbookFixture, passing in the name as constructor parameter.

public class HelpExamplesFixture : base("HelpExamples.xlsx") {}

public class HelpExampleTests : IClassFixture<HelpExamplesFixture>
{

    Workbook _wb;

    public HelpExampleTests(HelpExamplesFixture fixture) { _wb = fixture.Workbook; };

    [Fact]
    public void CheckSomething()
    {
        Assert.Equal(_wb.Range["A1"], 123);
    }     
}

@Sergey-Vlasov Do you have any thoughts on how this should work?

Lingua principale
C#
Stelle
0
Fork
2
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Excel-DNA/DeveloperTools

Tutte le issue di Excel-DNA/DeveloperTools

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.