-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathStudentServiceTests.logic.RetrieveAll.cs
More file actions
40 lines (33 loc) · 1.37 KB
/
StudentServiceTests.logic.RetrieveAll.cs
File metadata and controls
40 lines (33 loc) · 1.37 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
// -----------------------------------------------------------------------
// Copyright (c) Signature Chess Club & MumsWhoCode. All rights reserved.
// -----------------------------------------------------------------------
using FluentAssertions;
using Moq;
using SCMS.Services.Api.Models.Foundations.Students;
using System.Linq;
using Xunit;
namespace SCMS.Services.Tests.Unit.Services.Foundations.Students
{
public partial class StudentServiceTests
{
[Fact]
public void ShouldRetrieveAllStudentdAsync()
{
//given
IQueryable<Student> randomStudents = CreateRandomStudents();
IQueryable<Student> retrievedStudents = randomStudents;
IQueryable<Student> expectedStudents = retrievedStudents;
this.storageBrokerMock.Setup(broker =>
broker.SelectAllStudents()).Returns(retrievedStudents);
//when
IQueryable<Student> actualStudents = this.studentService.RetrieveAllStudents();
//then
actualStudents.Should().BeEquivalentTo(expectedStudents);
this.storageBrokerMock.Verify(broker =>
broker.SelectAllStudents(), Times.Once);
this.storageBrokerMock.VerifyNoOtherCalls();
this.dateTimeBrokerMock.VerifyNoOtherCalls();
this.loggingBrokerMock.VerifyNoOtherCalls();
}
}
}