public void ConstructorShouldConstructWithSetters() { //Arrange var batchId = 1; var batchCurriculum = "C#"; var startDate = new DateTime(2019, 1, 5); var endDate = new DateTime(2019, 1, 5); var trainingCenter = Guid.Parse("fa4d6c6e-9650-44c9-8c6b-5aebd3f9a67d"); //Act var apiBatch = new DatMod.Batch() { Id = batchId, BatchCurriculum = batchCurriculum, StartDate = startDate, EndDate = endDate, TrainingCenter = trainingCenter }; //Assert Assert.Equal(batchId, apiBatch.Id); Assert.Equal(batchCurriculum, apiBatch.BatchCurriculum); Assert.Equal(startDate, apiBatch.StartDate); Assert.Equal(endDate, apiBatch.EndDate); Assert.Equal(trainingCenter, apiBatch.TrainingCenter); }
/// <summary> /// Map a Entity Batch from a Model Batch /// </summary> /// <param name="batch">A Batch Model</param> /// <returns>A Batch Entity</returns> /// <exception cref="System.ArgumentException">Thrown when start date is after end date</exception> public Lib.Models.Batch MapBatch(Entities.Batch batch) { var newBatch = new Lib.Models.Batch() { Id = batch.Id, BatchCurriculum = batch.BatchCurriculum, TrainingCenter = batch.TrainingCenter }; newBatch.SetStartAndEndDate(batch.StartDate, batch.EndDate); return(newBatch); }