Skip to content

Commit

Permalink
Backup Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
neojarvis committed Sep 1, 2023
1 parent 46657b5 commit 62ea16c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
23 changes: 19 additions & 4 deletions Week2_day6_s2_3_own/TestProject/UnitTest1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ public class PostTests
[SetUp]
public void Setup()
{

// _mockContext = new Mock<OrdersDbContext>();
// _controller = new OrderController(_mockContext.Object);
//_postcontroller = new PostController();
_dbContextOptions = new DbContextOptionsBuilder<AppDbContext>()
.UseInMemoryDatabase(databaseName: "InMemoryTestDatabase")
.Options;

var dbContext = new AppDbContext(_dbContextOptions);
_libraryController = new LibraryController(dbContext);

}

Expand All @@ -56,6 +58,19 @@ private static MethodInfo GetMethod(Type type, string methodName, Type[] paramet
{
return type.GetMethod(methodName, BindingFlags.Public | BindingFlags.Instance, null, parameterTypes, null);
}
[Test]
public void DisplayBooksForLibraryCard_WithValidCardId_ReturnsViewResult()
{
// Arrange
int libraryCardId = 1; // Replace with a valid card ID

// Act
var result = _libraryController.DisplayBooksForLibraryCard(libraryCardId) as ViewResult;

// Assert
Assert.IsNotNull(result);
Assert.AreEqual("DisplayBooksForLibraryCard", result.ViewName);
}


[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@
2.0
2.0
2.0
2.0

0 comments on commit 62ea16c

Please sign in to comment.