public void Id_WhenIdIsSet_ExpectGetReturnsProperId() { // Arrange const int expected = 7; var classUnderTest = new ApplicationEntity { Id = expected, }; // Act var actual = classUnderTest.Id; // Assert Assert.AreEqual(expected, actual); }
public void Save() { this.Student.Save(); var applicationEntity = new ApplicationEntity { Id = Id, StudentId = Student.Id, AnnualPercentageRate = AnnualPercentageRate, Principal = Principal, TotalPayments = TotalPayments }; if (applicationEntity.Id > 0) { _applicationRepo.Update(applicationEntity); } else { Id = _applicationRepo.Create(applicationEntity); } }
public void Get_WhenValidApplicationIsPassed_ExpectEntityHasProperId() { // Arrange const int id = 7; const int studentId = 11; var application = new ApplicationEntity { Id = id, StudentId = studentId, }; var student = new StudentEntity { Id = studentId, }; var individual = new IndividualEntity { Id = studentId, }; var stubApplicationRepo = new Mock<IRepository<ApplicationEntity>>(); stubApplicationRepo.Setup(e => e.Retrieve(id)) .Returns(application); var stubStudentRepo = new Mock<IRepository<StudentEntity>>(); stubStudentRepo.Setup(e => e.Retrieve(studentId)) .Returns(student); var stubIndividualRepo = new Mock<IRepository<IndividualEntity>>(); stubIndividualRepo.Setup(e => e.Retrieve(studentId)) .Returns(individual); var classUnderTest = new Application(stubIndividualRepo.Object, stubStudentRepo.Object, stubApplicationRepo.Object); // Act classUnderTest.Get(id); // Assert var actual = classUnderTest.Id; Assert.AreEqual(id, actual); }
internal void LoadData(ApplicationEntity applicationEntity) { Id = applicationEntity.Id; Principal = applicationEntity.Principal; AnnualPercentageRate = applicationEntity.AnnualPercentageRate; TotalPayments = applicationEntity.TotalPayments; }