コード例 #1
0
    public void ShouldReturnSpecialStudent()
    {
        var expectedPersonName = BusinessRules.specialKey;

        // Arrange
        A.CallTo(() => _personRepository.GetAllPersons()).Returns(
            new List <Persons> {
            new Persons {
                First    = "Angelina",
                MiddleI  = expectedPersonName,
                Last     = "Jolie",
                Students = new Students {
                    Email = "*****@*****.**",
                }
            },
            new Persons {
                First    = "Brad",
                MiddleI  = "J",
                Last     = "Pitt",
                Students = new Students {
                    Email = "*****@*****.**",
                }
            }
        }
            );

        // Act
        var studentsDtos = _studentService.GetAllStudents();

        // Assert (FluentAssertions)
        studentsDtos.Single(pdto => pdto.Special).MiddleI.Should().Be(expectedPersonName);
    }
コード例 #2
0
 // GET: Students1
 public ActionResult Index()
 {
     return(View(service.GetAllStudents()));
 }