-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathUnitTests.cs
More file actions
50 lines (42 loc) · 1.58 KB
/
UnitTests.cs
File metadata and controls
50 lines (42 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using Exercise;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Execise.Tests
{
[TestClass]
public class UnitTests
{
//test the two calls to library instance return same instance
[TestMethod]
public void LibraryShouldBeSingleton()
{
//check that when you create a Library instance second time,
//you get exactly the same instance as for a very first time
var L1 = Library.getInstance();
var L2 = Library.getInstance();
Assert.AreEqual(L1, L2);
}
//test that an book was registered successfully by checking the returned Id value is not -1
[TestMethod]
public void BookShouldRegister()
{
Book B1 = new Book("Hello", "World", 2017, 10);
int result = RegistrationRepository.Register(B1);
Assert.AreNotEqual(-1, result);
}
//test that an customer was registered successfully by checking the returned Id value is not -1
[TestMethod]
public void CustomerShouldRegister()
{
Customer C1 = new Customer("Troy", "Winnipeg");
int result = RegistrationRepository.Register(C1);
Assert.AreNotEqual(-1, result);
}
//test that a book can be borrowed
[TestMethod]
public void CanBorrowBook()
{
//create a borrowable book with available amount more than one.
//Run BorrowOne method of the BookBorrowable instance. Check that total amount was reduced by one.
}
}
}