protected override void ProcessDemo() { var studentFactory = new StudentFactory(); var polishStudent = studentFactory.Create(Language.Polish); var englishStudent = studentFactory.Create(Language.English); polishStudent.Greetings(); englishStudent.Greetings(); }
public void CreateSeparateObjects() { StudentFactory sut = new StudentFactory(); TalentedPerson student1 = sut.Create("StudentWithoutSuperPower"); TalentedPerson student2 = sut.Create("StudentWithoutSuperPower"); Assert.NotSame(student1, student2); }
public void CreateStudent_NotInKredek() { StudentFactory sut = new StudentFactory(); TalentedPerson student1 = sut.Create("StudentWithoutSpecialPower"); TalentedPerson student2 = sut.Create("StudentWithoutSpecialPower"); Assert.NotSame(student1, student2); }
public ClientA() { Student = StudentFactory.Create(StudentType.Visiting); Student.Id = 90; Student.Name = "Waleed Ahmed"; System.Console.WriteLine($"Id : {Student.Id}, Name : {Student.Name}"); }
public void NotAllowFullNames() { StudentFactory sut = new StudentFactory(); Assert.Throws <ArgumentNullException>(() => sut.Create(null)); }
public void CreateStudent_NotInKredek() { StudentFactory sut = new StudentFactory(); TalentedPerson student = sut.Create("StudentWithoutSuperPowe"); Assert.IsType <Student>(student); }
public void DerivedClassDoesntBreakPolymorphism() { PersonFactory factory = new StudentFactory(); var person = factory.Create("Damir", "Arh"); Assert.That(person.GetType(), Is.EqualTo(typeof(StudentRecordImmutable))); }
public void DerivedClassMethodReturnsDerivedType() { var factory = new StudentFactory(); var person = factory.Create("Damir", "Arh"); Assert.That(person.GetType(), Is.EqualTo(typeof(StudentRecordImmutable))); }
public void DoAttendance() { List <Student> studentList = new List <Student>(); for (int i = 0; i < 1; i++) { studentList.Add(StudentFactory.Create(StudentType.Serious)); } }
public void CreateList_Method() { //Arrange GenerateStudents(); StudentFactory studentsFactory = new StudentFactory(); //Act Student[] result = studentsFactory.Create(); //Assert Assert.AreEqual(Students, result); }
public void CanAddStudentToRepository() { //Arrange Student student = StudentFactory.Create("Primary", 5, "Teste", "Testeee", "16105960649", "*****@*****.**"); this.MockStudentRepository.Setup(x => x.Save(student)).Returns(Status.SUCCESS); // Act var result = this.MockStudentRepository.Object.Save(student); // Assert this.MockStudentRepository.Verify(x => x.Save(student), Times.Once()); Assert.AreEqual(result, Status.SUCCESS); }
//private ScheduleFactory<ScheduleDTO> scheduleFactory = new ScheduleFactory<ScheduleDTO>(); public List <StudentDTO> GetStudents() { var students = new List <StudentDTO>(); foreach (var item in RT.GetStudents()) { var s = studentFactory.Create(); s.FirstName = item.FirstName; students.Add(s); } return(students); }
// Create student public static StudentCreate.Response Handle(IRepository repository, StudentCreate.Request request) { var container = new EntityStateWrapperContainer(); container.AddEntity(StudentFactory.Create(request.CommandModel)); var validationDetails = repository.Save(container); var studentId = default(int?); if (!validationDetails.HasValidationIssues) { studentId = container.FindEntity <Student>().ID; } return(new StudentCreate.Response(validationDetails, studentId)); }
public IEnumerable <Tuple <ICustomer, decimal> > CreateCustomersAndCalcDiscounts() { var result = new List <Tuple <ICustomer, decimal> >(); decimal applePrice = 10; var veteran = _warVeteransFactory.Create(); var student = _studentsFactory.Create(); var veteranDiscount = _warVeteransFactory.AddDiscount(veteran, applePrice); var studentDiscount = _studentsFactory.AddDiscount(student, applePrice); result.Add(Tuple.Create(veteran, veteranDiscount)); result.Add(Tuple.Create(student, studentDiscount)); return(result); }
public ActionResult Create(FormCollection collection) { try { var studentType = collection["Type"]; var student = StudentFactory.Create( studentType, counter, collection["Name.First"], collection["Name.Last"], collection["Cpf.Value"], collection["Email"] ); StudentRepository.Save(student); counter++; return(RedirectToAction("Index")); } catch { return(View()); } }