mercredi 25 novembre 2020

Resolved : C# Xunit code: End-of-file expected error. Cannot for the life of me figure out what the cause of this is

EDIT: Thank you The General for answering this. Deleting the bin and obj folders fixed it.

I'm currently trying to learn the C# fundamentals through Pluralsight and I'm currently at the Test Runner tutorial. I'm getting two problems which for the life of me I can't figure out, as it looks to me like I have the open/close brackets in all the right places. They say:

Type or namespace definition, or end-of-file expected [GradeBook.Tests] csharp(CS1022) [26, 6]
Type or namespace definition, or end-of-file expected [GradeBook.Tests] csharp(CS1022) [27, 1]

And the code I'm trying to compile is:

using System;
using Xunit;

namespace GradeBook.Tests
{
    public class BookTests
    {
        [Fact]
        public void Test1()
        {
            //arrange
            var book = new Book("");
            book.AddGrade(89.1);
            book.AddGrade(90.5);
            book.AddGrade(77.3);

            //act
            var result = book.GetStatistics();

            //assert
            Assert.Equal(85.6, result.Average);
            Assert.Equal(90.5, result.High);
            Assert.Equal(77.3, result.Low);
        }
    }
}

I'm probably missing something super obvious but I'm really struggling to figure out exactly what it is.

Much appreciated!

Aucun commentaire:

Enregistrer un commentaire