public FieldContainer(int id, string label, CDataValue description, string color, int displayOrder, string value, List <DataItem> dataItemList) { Id = id; Label = label; Description = description; Color = color; DisplayOrder = displayOrder; Value = value; DataItemList = dataItemList; FieldType = "FieldContainer"; }
public Signature(int id, bool mandatory, bool readOnly, string label, string description, string color, int displayOrder, bool dummy) { Id = id; Mandatory = mandatory; ReadOnly = readOnly; Label = label; Description = new CDataValue(); Description.InderValue = description; Color = color; DisplayOrder = displayOrder; Dummy = dummy; }
private void SetDefaultValue(IEnumerable <Element> elementLst, AppointmentPrefillFieldValue fv) { foreach (var element in elementLst) { if (element is DataElement dataElement) { foreach (var item in dataElement.DataItemList.Where(item => fv.FieldId == item.Id)) { switch (item) { case NumberStepper numberStepper: numberStepper.DefaultValue = int.Parse(fv.FieldValue); break; case Number number: number.DefaultValue = int.Parse(fv.FieldValue); break; case Comment comment: comment.Value = fv.FieldValue; break; case Text text: text.Value = fv.FieldValue; break; case None none: var cDataValue = new CDataValue(); cDataValue.InderValue = fv.FieldValue; none.Description = cDataValue; break; case EntitySearch entitySearch: entitySearch.DefaultValue = int.Parse(fv.FieldValue); break; case EntitySelect entitySelect: entitySelect.DefaultValue = int.Parse(fv.FieldValue); break; } } } else { var groupElement = (GroupElement)element; SetDefaultValue(groupElement.ElementList, fv); } } }
public Timer(int id, bool mandatory, bool readOnly, string label, string description, string color, int displayOrder, bool dummy, bool stopOnSave) { Id = id; Mandatory = mandatory; ReadOnly = readOnly; Label = label; Description = new CDataValue(); Description.InderValue = description; Color = color; DisplayOrder = displayOrder; Dummy = dummy; StopOnSave = stopOnSave; }
public Picture(int id, bool mandatory, bool readOnly, string label, string description, string color, int displayOrder, bool dummy, int multi, bool geolocationEnabled) { Id = id; Mandatory = mandatory; ReadOnly = readOnly; Label = label; Description = new CDataValue(); Description.InderValue = description; Color = color; DisplayOrder = displayOrder; Dummy = dummy; Multi = multi; GeolocationEnabled = geolocationEnabled; }
public CheckBox(int id, bool mandatory, bool readOnly, string label, string description, string color, int displayOrder, bool dummy, bool defaultValue, bool selected) { Id = id; Mandatory = mandatory; ReadOnly = readOnly; Label = label; Description = new CDataValue(); Description.InderValue = description; Color = color; DisplayOrder = displayOrder; Dummy = dummy; DefaultValue = defaultValue; Selected = selected; }
public EntitySelect(int id, bool mandatory, bool readOnly, string label, string description, string color, int displayOrder, bool dummy, int defaultValue, int source) { Id = id; Mandatory = mandatory; ReadOnly = readOnly; Label = label; Description = new CDataValue(); Description.InderValue = description; Color = color; DisplayOrder = displayOrder; Dummy = dummy; DefaultValue = defaultValue; Source = source; }
public SingleSelect(int id, bool mandatory, bool readOnly, string label, string description, string color, int displayOrder, bool dummy, List <KeyValuePair> keyValuePairList) { KeyValuePairList = new List <KeyValuePair>(); Id = id; Mandatory = mandatory; ReadOnly = readOnly; Label = label; Description = new CDataValue(); Description.InderValue = description; Color = color; DisplayOrder = displayOrder; Dummy = dummy; KeyValuePairList = keyValuePairList; }
public Date(int id, bool mandatory, bool readOnly, string label, string description, string color, int displayOrder, bool dummy, DateTime minValue, DateTime maxValue, string defaultValue) { Id = id; Mandatory = mandatory; ReadOnly = readOnly; Label = label; Description = new CDataValue(); Description.InderValue = description; Color = color; DisplayOrder = displayOrder; Dummy = dummy; DefaultValue = defaultValue; MaxValue = maxValue; MinValue = minValue; }
public Comment(int id, bool mandatory, bool readOnly, string label, string description, string color, int displayOrder, bool dummy, string value, int maxLength, bool splitScreen) { Id = id; Mandatory = mandatory; ReadOnly = readOnly; Label = label; Description = new CDataValue(); Description.InderValue = description; Color = color; DisplayOrder = displayOrder; Dummy = dummy; Value = value; Maxlength = maxLength; SplitScreen = splitScreen; }
public CheckListValue(DataElement dataElement, string status) { Id = dataElement.Id; Label = dataElement.Label; DisplayOrder = dataElement.DisplayOrder; Description = new CDataValue(); Description.InderValue = dataElement.Description.InderValue; ApprovalEnabled = dataElement.ApprovalEnabled; ReviewEnabled = dataElement.ReviewEnabled; DoneButtonEnabled = dataElement.DoneButtonEnabled; ExtraFieldsEnabled = dataElement.ExtraFieldsEnabled; PinkBarText = dataElement.PinkBarText; DataItemGroupList = dataElement.DataItemGroupList; DataItemList = dataElement.DataItemList; Status = status; }
public GroupElement(int id, string label, int displayOrder, string description, bool approvedEnabled, bool reviewEnabled, bool doneButtonEnabled, bool extraDataElementsEnabled, string pinkBarText, List <Element> elementList) { ElementList = new List <Element>(); Id = id; Label = label; DisplayOrder = displayOrder; Description = new CDataValue(); Description.InderValue = description; ApprovalEnabled = approvedEnabled; ReviewEnabled = reviewEnabled; DoneButtonEnabled = doneButtonEnabled; ExtraFieldsEnabled = extraDataElementsEnabled; PinkBarText = pinkBarText; ElementList = elementList; }
public NumberStepper(int id, bool mandatory, bool readOnly, string label, string description, string color, int displayOrder, bool dummy, string minValue, string maxValue, int defaultValue, int decimalCount, string unitName) { Id = id; Mandatory = mandatory; ReadOnly = readOnly; Label = label; Description = new CDataValue(); Description.InderValue = description; Color = color; DisplayOrder = displayOrder; Dummy = dummy; MinValue = minValue; MaxValue = maxValue; DefaultValue = defaultValue; DecimalCount = decimalCount; UnitName = unitName; }
public EntitySearch(int id, bool mandatory, bool readOnly, string label, string description, string color, int displayOrder, bool dummy, int defaultValue, int entityTypeId, bool isNum, string queryType, int minSearchLenght, bool barcodeEnabled, string barcodeType) { Id = id; Mandatory = mandatory; ReadOnly = readOnly; Label = label; Description = new CDataValue(); Description.InderValue = description; Color = color; DisplayOrder = displayOrder; Dummy = dummy; DefaultValue = defaultValue; EntityTypeId = entityTypeId; IsNum = isNum; QueryType = queryType; MinSearchLenght = minSearchLenght; BarcodeEnabled = barcodeEnabled; BarcodeType = barcodeType; }
public Text(int id, bool mandatory, bool readOnly, string label, string description, string color, int displayOrder, bool dummy, string value, int maxLength, bool geolocationEnabled, bool geolocationForced, bool geolocationhidden, bool barcodeEnabled, string barcodeType) { Id = id; Mandatory = mandatory; ReadOnly = readOnly; Label = label; Description = new CDataValue(); Description.InderValue = description; Color = color; DisplayOrder = displayOrder; Dummy = dummy; Value = value; MaxLength = maxLength; GeolocationEnabled = geolocationEnabled; GeolocationForced = geolocationForced; GeolocationHidden = geolocationhidden; BarcodeEnabled = barcodeEnabled; BarcodeType = barcodeType; }
public DataElement(int id, string label, int displayOrder, string description, bool approvalEnabled, bool reviewEnabled, bool doneButtonEnabled, bool extraDataElementsEnabled, string pinkBarText, bool quickSyncEnabled, List <DataItemGroup> dataItemGroupList, List <DataItem> dataItemList) { //DataItemGroupList = new List<DataItemGroup>(); //DataItemList = new List<DataItem>(); Id = id; Label = label; DisplayOrder = displayOrder; Description = new CDataValue(); Description.InderValue = description; ApprovalEnabled = approvalEnabled; ReviewEnabled = reviewEnabled; DoneButtonEnabled = doneButtonEnabled; ExtraFieldsEnabled = extraDataElementsEnabled; PinkBarText = pinkBarText; QuickSyncEnabled = quickSyncEnabled; DataItemGroupList = dataItemGroupList; DataItemList = dataItemList; }
public async Task SQL_Check_CheckRead_ReturnsReplyElement() { // Arrance #region Arrance Random rnd = new Random(); #region Template1 DateTime cl1_Ca = DateTime.Now; DateTime cl1_Ua = DateTime.Now; check_lists cl1 = await testHelpers.CreateTemplate(cl1_Ca, cl1_Ua, "A", "D", "CheckList", "Template1FolderName", 1, 1); #endregion #region SubTemplate1 check_lists cl2 = await testHelpers.CreateSubTemplate("A.1", "D.1", "CheckList", 1, 1, cl1); #endregion #region Fields #region field1 fields f1 = await testHelpers.CreateField(1, "barcode", cl2, "e2f4fb", "custom", null, "", "Comment field description", 5, 1, dbContext.field_types.Where(x => x.FieldType == "comment").First(), 0, 0, 1, 0, "Comment field", 1, 55, "55", "0", 0, 0, null, 1, 0, 0, 0, "", 49); #endregion #region field2 fields f2 = await testHelpers.CreateField(1, "barcode", cl2, "f5eafa", "custom", null, "", "showPDf Description", 45, 1, dbContext.field_types.Where(x => x.FieldType == "comment").First(), 0, 1, 0, 0, "ShowPdf", 0, 5, "5", "0", 0, 0, null, 0, 0, 0, 0, "", 9); #endregion #region field3 fields f3 = await testHelpers.CreateField(0, "barcode", cl2, "f0f8db", "custom", 3, "", "Number Field Description", 83, 0, dbContext.field_types.Where(x => x.FieldType == "number").First(), 0, 0, 1, 0, "Numberfield", 1, 8, "4865", "0", 0, 1, null, 1, 0, 0, 0, "", 1); #endregion #region field4 fields f4 = await testHelpers.CreateField(1, "barcode", cl2, "fff6df", "custom", null, "", "date Description", 84, 0, dbContext.field_types.Where(x => x.FieldType == "comment").First(), 0, 0, 1, 0, "Date", 1, 666, "41153", "0", 0, 1, null, 0, 1, 0, 0, "", 1); #endregion #region field5 fields f5 = await testHelpers.CreateField(0, "barcode", cl2, "ffe4e4", "custom", null, "", "picture Description", 85, 0, dbContext.field_types.Where(x => x.FieldType == "comment").First(), 1, 0, 1, 0, "Picture", 1, 69, "69", "1", 0, 1, null, 0, 1, 0, 0, "", 1); #endregion #endregion #region Worker workers worker = await testHelpers.CreateWorker("*****@*****.**", "Arne", "Jensen", 21); #endregion #region site sites site = await testHelpers.CreateSite("SiteName", 88); #endregion #region units units unit = await testHelpers.CreateUnit(48, 49, site, 348); #endregion #region site_workers site_workers site_workers = await testHelpers.CreateSiteWorker(55, site, worker); #endregion #region Case1 cases aCase = await testHelpers.CreateCase("caseUId", cl1, DateTime.Now, "custom", DateTime.Now, worker, rnd.Next(1, 255), rnd.Next(1, 255), site, 66, "caseType", unit, DateTime.Now, 1, worker, Constants.WorkflowStates.Created); #endregion #region Check List Values check_list_values check_List_Values = await testHelpers.CreateCheckListValue(aCase, cl2, "completed", null, 865); #endregion #region Field Values #region fv1 field_values field_Values1 = await testHelpers.CreateFieldValue(aCase, cl2, f1, null, null, "tomt1", 61234, worker); #endregion #region fv2 field_values field_Values2 = await testHelpers.CreateFieldValue(aCase, cl2, f2, null, null, "tomt2", 61234, worker); #endregion #region fv3 field_values field_Values3 = await testHelpers.CreateFieldValue(aCase, cl2, f3, null, null, "tomt3", 61234, worker); #endregion #region fv4 field_values field_Values4 = await testHelpers.CreateFieldValue(aCase, cl2, f4, null, null, "tomt4", 61234, worker); #endregion #region fv5 field_values field_Values5 = await testHelpers.CreateFieldValue(aCase, cl2, f5, null, null, "tomt5", 61234, worker); #endregion #endregion #endregion // Act ReplyElement match = await sut.CheckRead((int)aCase.MicrotingUid, (int)aCase.MicrotingCheckUid); // Assert #region Assert Assert.AreEqual(1, match.ElementList.Count()); CheckListValue clv = (CheckListValue)match.ElementList[0]; Assert.AreEqual(5, clv.DataItemList.Count); #region casts Field _f1 = (Field)clv.DataItemList[0]; Field _f2 = (Field)clv.DataItemList[1]; Field _f3 = (Field)clv.DataItemList[2]; Field _f4 = (Field)clv.DataItemList[3]; Field _f5 = (Field)clv.DataItemList[4]; #endregion #region Barcode Assert.AreEqual(f1.BarcodeEnabled, 1); Assert.AreEqual(f2.BarcodeEnabled, 1); Assert.AreEqual(f3.BarcodeEnabled, 0); Assert.AreEqual(f4.BarcodeEnabled, 1); Assert.AreEqual(f5.BarcodeEnabled, 0); Assert.AreEqual(f1.BarcodeType, "barcode"); Assert.AreEqual(f2.BarcodeType, "barcode"); Assert.AreEqual(f3.BarcodeType, "barcode"); Assert.AreEqual(f4.BarcodeType, "barcode"); Assert.AreEqual(f5.BarcodeType, "barcode"); #endregion #region chckl_id Assert.AreEqual(f1.CheckListId, cl2.Id); Assert.AreEqual(f2.CheckListId, cl2.Id); Assert.AreEqual(f3.CheckListId, cl2.Id); Assert.AreEqual(f4.CheckListId, cl2.Id); Assert.AreEqual(f5.CheckListId, cl2.Id); #endregion #region Color Assert.AreEqual(f1.Color, _f1.FieldValues[0].Color); Assert.AreEqual(f2.Color, _f2.FieldValues[0].Color); Assert.AreEqual(f3.Color, _f3.FieldValues[0].Color); Assert.AreEqual(f4.Color, _f4.FieldValues[0].Color); Assert.AreEqual(f5.Color, _f5.FieldValues[0].Color); #endregion #region custom // Assert.AreEqual(f1.custom, _f1.FieldValues[0].Id); #endregion #region Decimal_Count Assert.AreEqual(f1.DecimalCount, null); Assert.AreEqual(f2.DecimalCount, null); Assert.AreEqual(f3.DecimalCount, 3); Assert.AreEqual(f4.DecimalCount, null); Assert.AreEqual(f5.DecimalCount, null); #endregion #region Default_value Assert.AreEqual(f1.DefaultValue, ""); Assert.AreEqual(f2.DefaultValue, ""); Assert.AreEqual(f3.DefaultValue, ""); Assert.AreEqual(f4.DefaultValue, ""); Assert.AreEqual(f5.DefaultValue, ""); #endregion #region Description CDataValue f1desc = (CDataValue)_f1.Description; CDataValue f2desc = (CDataValue)_f2.Description; CDataValue f3desc = (CDataValue)_f3.Description; CDataValue f4desc = (CDataValue)_f4.Description; CDataValue f5desc = (CDataValue)_f5.Description; Assert.AreEqual(f1.Description, f1desc.InderValue); Assert.AreEqual(f2.Description, f2desc.InderValue); Assert.AreEqual(f3.Description, f3desc.InderValue); Assert.AreEqual(f4.Description, f4desc.InderValue); Assert.AreEqual(f5.Description, f5desc.InderValue); #endregion #region Displayindex Assert.AreEqual(f1.DisplayIndex, _f1.FieldValues[0].DisplayOrder); Assert.AreEqual(f2.DisplayIndex, _f2.FieldValues[0].DisplayOrder); Assert.AreEqual(f3.DisplayIndex, _f3.FieldValues[0].DisplayOrder); Assert.AreEqual(f4.DisplayIndex, _f4.FieldValues[0].DisplayOrder); Assert.AreEqual(f5.DisplayIndex, _f5.FieldValues[0].DisplayOrder); #endregion #region Dummy Assert.AreEqual(f1.Dummy, 1); Assert.AreEqual(f2.Dummy, 1); Assert.AreEqual(f3.Dummy, 0); Assert.AreEqual(f4.Dummy, 0); Assert.AreEqual(f5.Dummy, 0); #endregion #region geolocation #region enabled Assert.AreEqual(f1.GeolocationEnabled, 0); Assert.AreEqual(f2.GeolocationEnabled, 0); Assert.AreEqual(f3.GeolocationEnabled, 0); Assert.AreEqual(f4.GeolocationEnabled, 0); Assert.AreEqual(f5.GeolocationEnabled, 1); #endregion #region forced Assert.AreEqual(f1.GeolocationForced, 0); Assert.AreEqual(f2.GeolocationForced, 1); Assert.AreEqual(f3.GeolocationForced, 0); Assert.AreEqual(f4.GeolocationForced, 0); Assert.AreEqual(f5.GeolocationForced, 0); #endregion #region hidden Assert.AreEqual(f1.GeolocationHidden, 1); Assert.AreEqual(f2.GeolocationHidden, 0); Assert.AreEqual(f3.GeolocationHidden, 1); Assert.AreEqual(f4.GeolocationHidden, 1); Assert.AreEqual(f5.GeolocationHidden, 1); #endregion #endregion #region isNum Assert.AreEqual(f1.IsNum, 0); Assert.AreEqual(f2.IsNum, 0); Assert.AreEqual(f3.IsNum, 0); Assert.AreEqual(f4.IsNum, 0); Assert.AreEqual(f5.IsNum, 0); #endregion #region Label Assert.AreEqual(f1.Label, _f1.Label); Assert.AreEqual(f2.Label, _f2.Label); Assert.AreEqual(f3.Label, _f3.Label); Assert.AreEqual(f4.Label, _f4.Label); Assert.AreEqual(f5.Label, _f5.Label); #endregion #region Mandatory Assert.AreEqual(f1.Mandatory, 1); Assert.AreEqual(f2.Mandatory, 0); Assert.AreEqual(f3.Mandatory, 1); Assert.AreEqual(f4.Mandatory, 1); Assert.AreEqual(f5.Mandatory, 1); #endregion #region maxLength Assert.AreEqual(f1.MaxLength, 55); Assert.AreEqual(f2.MaxLength, 5); Assert.AreEqual(f3.MaxLength, 8); Assert.AreEqual(f4.MaxLength, 666); Assert.AreEqual(f5.MaxLength, 69); #endregion #region min/max_Value #region max Assert.AreEqual(f1.MaxValue, "55"); Assert.AreEqual(f2.MaxValue, "5"); Assert.AreEqual(f3.MaxValue, "4865"); Assert.AreEqual(f4.MaxValue, "41153"); Assert.AreEqual(f5.MaxValue, "69"); #endregion #region min Assert.AreEqual(f1.MinValue, "0"); Assert.AreEqual(f2.MinValue, "0"); Assert.AreEqual(f3.MinValue, "0"); Assert.AreEqual(f4.MinValue, "0"); Assert.AreEqual(f5.MinValue, "1"); #endregion #endregion #region Multi Assert.AreEqual(f1.Multi, 0); Assert.AreEqual(f2.Multi, 0); Assert.AreEqual(f3.Multi, 0); Assert.AreEqual(f4.Multi, 0); Assert.AreEqual(f5.Multi, 0); #endregion #region Optional Assert.AreEqual(f1.Optional, 0); Assert.AreEqual(f2.Optional, 0); Assert.AreEqual(f3.Optional, 1); Assert.AreEqual(f4.Optional, 1); Assert.AreEqual(f5.Optional, 1); #endregion #region Query_Type Assert.AreEqual(f1.QueryType, null); Assert.AreEqual(f2.QueryType, null); Assert.AreEqual(f3.QueryType, null); Assert.AreEqual(f4.QueryType, null); Assert.AreEqual(f5.QueryType, null); #endregion #region Read_Only Assert.AreEqual(f1.ReadOnly, 1); Assert.AreEqual(f2.ReadOnly, 0); Assert.AreEqual(f3.ReadOnly, 1); Assert.AreEqual(f4.ReadOnly, 0); Assert.AreEqual(f5.ReadOnly, 0); #endregion #region Selected Assert.AreEqual(f1.Selected, 0); Assert.AreEqual(f2.Selected, 0); Assert.AreEqual(f3.Selected, 0); Assert.AreEqual(f4.Selected, 1); Assert.AreEqual(f5.Selected, 1); #endregion #region Split_Screen Assert.AreEqual(f1.SplitScreen, 0); Assert.AreEqual(f2.SplitScreen, 0); Assert.AreEqual(f3.SplitScreen, 0); Assert.AreEqual(f4.SplitScreen, 0); Assert.AreEqual(f5.SplitScreen, 0); #endregion #region Stop_On_Save Assert.AreEqual(f1.StopOnSave, 0); Assert.AreEqual(f2.StopOnSave, 0); Assert.AreEqual(f3.StopOnSave, 0); Assert.AreEqual(f4.StopOnSave, 0); Assert.AreEqual(f5.StopOnSave, 0); #endregion #region Unit_Name Assert.AreEqual(f1.UnitName, ""); Assert.AreEqual(f2.UnitName, ""); Assert.AreEqual(f3.UnitName, ""); Assert.AreEqual(f4.UnitName, ""); Assert.AreEqual(f5.UnitName, ""); #endregion #region Values Assert.AreEqual(1, _f1.FieldValues.Count()); Assert.AreEqual(1, _f2.FieldValues.Count()); Assert.AreEqual(1, _f3.FieldValues.Count()); Assert.AreEqual(1, _f4.FieldValues.Count()); Assert.AreEqual(1, _f5.FieldValues.Count()); Assert.AreEqual(field_Values1.Value, _f1.FieldValues[0].Value); Assert.AreEqual(field_Values2.Value, _f2.FieldValues[0].Value); Assert.AreEqual(field_Values3.Value, _f3.FieldValues[0].Value); Assert.AreEqual(field_Values4.Value, _f4.FieldValues[0].Value); Assert.AreEqual(field_Values5.Value, _f5.FieldValues[0].Value); #endregion #region Version Assert.AreEqual(f1.Version, 49); Assert.AreEqual(f2.Version, 9); Assert.AreEqual(f3.Version, 1); Assert.AreEqual(f4.Version, 1); Assert.AreEqual(f5.Version, 1); #endregion #endregion }
public async Task <OperationResult> Create(ContractInspectionModel contractInspectionCreateModel) { try { Core core = await _coreHelper.GetCore(); await using MicrotingDbContext context = core.DbContextHelper.GetDbContext(); // finde eform fra settings List <ContractRentableItem> contractRentableItem = await _dbContext.ContractRentableItem.Where(x => x.ContractId == contractInspectionCreateModel.ContractId && x.WorkflowState != Constants.WorkflowStates.Removed).ToListAsync(); foreach (var item in contractRentableItem) { int rentableItemId = item.RentableItemId; RentableItem rentableItem = await _dbContext.RentableItem.FirstOrDefaultAsync(x => x.Id == rentableItemId); int eFormId = rentableItem.eFormId; Contract dbContract = await _dbContext.Contract.FirstOrDefaultAsync(x => x.Id == contractInspectionCreateModel.ContractId); Customer dbCustomer = await _customersPnDbContext.Customers.SingleOrDefaultAsync(x => x.Id == dbContract.CustomerId); Site site = await context.Sites.SingleAsync(x => x.Id == contractInspectionCreateModel.SiteId); Language language = await context.Languages.SingleAsync(x => x.Id == site.LanguageId); MainElement mainElement = await core.ReadeForm(eFormId, language); mainElement.Repeated = 1; mainElement.EndDate = DateTime.Now.AddDays(14).ToUniversalTime(); mainElement.StartDate = DateTime.Now.ToUniversalTime(); mainElement.Label = ""; mainElement.Label += string.IsNullOrEmpty(rentableItem.SerialNumber) ? "" : $"{rentableItem.SerialNumber}"; mainElement.Label += string.IsNullOrEmpty(rentableItem.VinNumber) ? "" : $"{rentableItem.VinNumber}"; mainElement.Label += string.IsNullOrEmpty(rentableItem.Brand) ? "" : $"<br>{rentableItem.Brand}"; mainElement.Label += string.IsNullOrEmpty(rentableItem.ModelName) ? "" : $"<br>{rentableItem.ModelName}"; mainElement.Label += string.IsNullOrEmpty(dbCustomer.ContactPerson) ? "" : $"<br>{dbCustomer.ContactPerson}"; CDataValue cDataValue = new CDataValue(); cDataValue.InderValue = $"<b>Kontrakt Nr:<b>{dbContract.ContractNr.ToString()}<br>"; cDataValue.InderValue += $"<b>Kunde Nr:<b>{dbContract.CustomerId.ToString()}"; List <SiteDto> sites = new List <SiteDto>(); int?sdkCaseId = await core.CaseCreate(mainElement, "", (int)site.MicrotingUid, null); if (sdkCaseId != null) { ContractInspection contractInspection = new ContractInspection { ContractId = contractInspectionCreateModel.ContractId }; await contractInspection.Create(_dbContext); ContractInspectionItem contractInspectionItem = new ContractInspectionItem { ContractInspectionId = contractInspection.Id, RentableItemId = rentableItemId, SiteId = site.Id, SDKCaseId = (int)sdkCaseId, Status = 33 }; await contractInspectionItem.Create(_dbContext); } } return(new OperationResult(true, "Inspection Created Successfully")); } catch (Exception e) { Trace.TraceError(e.Message); _logger.LogError(e.Message); return(new OperationResult(false, _rentableItemsLocalizationService.GetString("ErrorWhileCreatingContractInspection"))); } }
#pragma warning disable 1998 public async Task Handle(TrashInspectionCaseCreated message) { TrashInspectionCase trashInspectionCase = await _dbContext.TrashInspectionCases.SingleOrDefaultAsync(x => x.Id == message.TrashInspectionCaseId); LogEvent($"TrashInspectionCaseCreatedHandler.Handle: called for message.TrashInspectionModel.WeighingNumber / message.TrashInspectionCase.Id : {message.TrashInspectionModel.WeighingNumber} / {message.TrashInspectionCaseId}"); CultureInfo cultureInfo = new CultureInfo("de-DE"); int sdkSiteId = trashInspectionCase.SdkSiteId; await using MicrotingDbContext microtingDbContext = _core.DbContextHelper.GetDbContext(); Site site = await microtingDbContext.Sites.SingleAsync(x => x.MicrotingUid == sdkSiteId); Language language = await microtingDbContext.Languages.SingleAsync(x => x.Id == site.LanguageId); LogEvent($"TrashInspectionCaseCreatedHandler: sdkSiteId: {sdkSiteId}, message.TemplateId: {message.TemplateId} "); MainElement mainElement = await _core.ReadeForm(message.TemplateId, language); TrashInspectionModel createModel = message.TrashInspectionModel; Segment segment = await _dbContext.Segments.SingleOrDefaultAsync(x => x.Id == message.SegmentId); Fraction fraction = await _dbContext.Fractions.SingleOrDefaultAsync(x => x.Id == message.FractionId); LogEvent($"TrashInspectionCaseCreatedHandler: Segment: {segment.Name}, TrashFraction: {fraction.Name} "); mainElement.Repeated = 1; mainElement.EndDate = DateTime.Now.AddDays(2).ToUniversalTime(); mainElement.StartDate = DateTime.Now.ToUniversalTime(); await using (var dbContext = _core.DbContextHelper.GetDbContext()) { mainElement.CheckListFolderName = dbContext.Folders.Single(x => x.Id == segment.SdkFolderId).MicrotingUid.ToString(); } mainElement.Label = createModel.RegistrationNumber.ToUpper() + ", " + createModel.Transporter; mainElement.EnableQuickSync = true; mainElement.DisplayOrder = (int)Math.Round(DateTime.Now.Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds) * -1; TimeZoneInfo timeZoneInfo; try { timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("Europe/Copenhagen"); } catch { timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("E. Europe Standard Time"); } var localTime = TimeZoneInfo.ConvertTimeFromUtc(createModel.Time, timeZoneInfo); CDataValue cDataValue = new CDataValue { InderValue = $"<b>Vejenr:</b> {createModel.WeighingNumber}<br>" }; cDataValue.InderValue += $"<b>Dato:</b> {createModel.Date.ToString("dd-MM-yyyy") + " " + localTime.ToString("T", cultureInfo)}<br>"; cDataValue.InderValue += $"<b>Område:</b> {segment.Name}<br>"; cDataValue.InderValue += $"<b>Producent:</b> {createModel.Producer}<br>"; cDataValue.InderValue += $"<b>Varenummer:</b> {fraction.ItemNumber} {fraction.Name}"; if (createModel.EakCode != null) { cDataValue.InderValue += $"<br><b>EAK Kode:</b> {createModel.EakCode}"; } mainElement.PushMessageTitle = mainElement.Label; mainElement.PushMessageBody = ""; if (createModel.MustBeInspected && !createModel.ExtendedInspection) { mainElement.PushMessageBody += "*** SKAL INSPICERES ***\n"; cDataValue.InderValue += "<br><br><b>*** SKAL INSPICERES ***</b>"; } if (createModel.ExtendedInspection) { mainElement.PushMessageBody += "*** LOVPLIGTIG KONTROL ***\n"; cDataValue.InderValue += "<br><br><b>*** LOVPLIGTIG KONTROL ***</b>"; mainElement.Color = Constants.CheckListColors.Red; } mainElement.PushMessageBody += $"Vare: {fraction.Name}\n"; if (createModel.Producer.Length > 17) { mainElement.PushMessageBody += $"Producent: {createModel.Producer.Substring(0,17)}..."; } else { mainElement.PushMessageBody += $"Producent: {createModel.Producer}"; } mainElement.ElementList[0].Description = cDataValue; mainElement.ElementList[0].Label = mainElement.Label; DataElement dataElement = (DataElement)mainElement.ElementList[0]; dataElement.DataItemList[0].Label = mainElement.Label; dataElement.DataItemList[0].Description = cDataValue; if (createModel.MustBeInspected || createModel.ExtendedInspection) { dataElement.DataItemList[0].Color = Constants.FieldColors.Red; } LogEvent("CreateTrashInspection: Trying to create SDK case"); int?sdkCaseId = await _core.CaseCreate(mainElement, "", sdkSiteId, segment.SdkFolderId); LogEvent($"CreateTrashInspection: SDK case created and got id {sdkCaseId}"); trashInspectionCase.SdkCaseId = sdkCaseId.ToString(); trashInspectionCase.Status = 66; await trashInspectionCase.Update(_dbContext); var trashInspectionCases = _dbContext.TrashInspectionCases.AsNoTracking().Where(x => x.TrashInspectionId == trashInspectionCase.TrashInspectionId); bool allDone = true; foreach (TrashInspectionCase inspectionCase in trashInspectionCases) { if (inspectionCase.Status < 66) { allDone = false; } } if (allDone) { var trashInspection = await _dbContext.TrashInspections.SingleOrDefaultAsync(x => x.Id == trashInspectionCase.TrashInspectionId); if (trashInspection.Status < 66) { trashInspection.Status = 66; await trashInspection.Update(_dbContext); } } }
public void SQL_Check_CheckRead_ReturnsReplyElement() { // Arrance #region Arrance #region Template1 DateTime cl1_Ca = DateTime.Now; DateTime cl1_Ua = DateTime.Now; check_lists cl1 = testHelpers.CreateTemplate(cl1_Ca, cl1_Ua, "A", "D", "CheckList", "Template1FolderName", 1, 1); #endregion #region SubTemplate1 check_lists cl2 = testHelpers.CreateSubTemplate("A.1", "D.1", "CheckList", 1, 1, cl1); #endregion #region Fields #region field1 fields f1 = testHelpers.CreateField(1, "barcode", cl2, "e2f4fb", "custom", null, "", "Comment field description", 5, 1, DbContext.field_types.Where(x => x.field_type == "comment").First(), 0, 0, 1, 0, "Comment field", 1, 55, "55", "0", 0, 0, null, 1, 0, 0, 0, "", 49); #endregion #region field2 fields f2 = testHelpers.CreateField(1, "barcode", cl2, "f5eafa", "custom", null, "", "showPDf Description", 45, 1, DbContext.field_types.Where(x => x.field_type == "comment").First(), 0, 1, 0, 0, "ShowPdf", 0, 5, "5", "0", 0, 0, null, 0, 0, 0, 0, "", 9); #endregion #region field3 fields f3 = testHelpers.CreateField(0, "barcode", cl2, "f0f8db", "custom", 3, "", "Number Field Description", 83, 0, DbContext.field_types.Where(x => x.field_type == "number").First(), 0, 0, 1, 0, "Numberfield", 1, 8, "4865", "0", 0, 1, null, 1, 0, 0, 0, "", 1); #endregion #region field4 fields f4 = testHelpers.CreateField(1, "barcode", cl2, "fff6df", "custom", null, "", "date Description", 84, 0, DbContext.field_types.Where(x => x.field_type == "comment").First(), 0, 0, 1, 0, "Date", 1, 666, "41153", "0", 0, 1, null, 0, 1, 0, 0, "", 1); #endregion #region field5 fields f5 = testHelpers.CreateField(0, "barcode", cl2, "ffe4e4", "custom", null, "", "picture Description", 85, 0, DbContext.field_types.Where(x => x.field_type == "comment").First(), 1, 0, 1, 0, "Picture", 1, 69, "69", "1", 0, 1, null, 0, 1, 0, 0, "", 1); #endregion #endregion #region Worker workers worker = testHelpers.CreateWorker("*****@*****.**", "Arne", "Jensen", 21); #endregion #region site sites site = testHelpers.CreateSite("SiteName", 88); #endregion #region units units unit = testHelpers.CreateUnit(48, 49, site, 348); #endregion #region site_workers site_workers site_workers = testHelpers.CreateSiteWorker(55, site, worker); #endregion #region Case1 cases aCase = testHelpers.CreateCase("caseUId", cl1, DateTime.Now, "custom", DateTime.Now, worker, "microtingCheckUId", "microtingUId", site, 66, "caseType", unit, DateTime.Now, 1, worker, Constants.WorkflowStates.Created); #endregion #region Check List Values check_list_values check_List_Values = testHelpers.CreateCheckListValue(aCase, cl2, "completed", null, 865); #endregion #region Field Values #region fv1 field_values field_Values1 = testHelpers.CreateFieldValue(aCase, cl2, f1, null, null, "tomt1", 61234, worker); #endregion #region fv2 field_values field_Values2 = testHelpers.CreateFieldValue(aCase, cl2, f2, null, null, "tomt2", 61234, worker); #endregion #region fv3 field_values field_Values3 = testHelpers.CreateFieldValue(aCase, cl2, f3, null, null, "tomt3", 61234, worker); #endregion #region fv4 field_values field_Values4 = testHelpers.CreateFieldValue(aCase, cl2, f4, null, null, "tomt4", 61234, worker); #endregion #region fv5 field_values field_Values5 = testHelpers.CreateFieldValue(aCase, cl2, f5, null, null, "tomt5", 61234, worker); #endregion #endregion #endregion // Act ReplyElement match = sut.CheckRead(aCase.microting_uid, aCase.microting_check_uid); // Assert #region Assert Assert.AreEqual(1, match.ElementList.Count()); CheckListValue clv = (CheckListValue)match.ElementList[0]; Assert.AreEqual(5, clv.DataItemList.Count); #region casts Field _f1 = (Field)clv.DataItemList[0]; Field _f2 = (Field)clv.DataItemList[1]; Field _f3 = (Field)clv.DataItemList[2]; Field _f4 = (Field)clv.DataItemList[3]; Field _f5 = (Field)clv.DataItemList[4]; #endregion #region Barcode Assert.AreEqual(f1.barcode_enabled, 1); Assert.AreEqual(f2.barcode_enabled, 1); Assert.AreEqual(f3.barcode_enabled, 0); Assert.AreEqual(f4.barcode_enabled, 1); Assert.AreEqual(f5.barcode_enabled, 0); Assert.AreEqual(f1.barcode_type, "barcode"); Assert.AreEqual(f2.barcode_type, "barcode"); Assert.AreEqual(f3.barcode_type, "barcode"); Assert.AreEqual(f4.barcode_type, "barcode"); Assert.AreEqual(f5.barcode_type, "barcode"); #endregion #region chckl_id Assert.AreEqual(f1.check_list_id, cl2.id); Assert.AreEqual(f2.check_list_id, cl2.id); Assert.AreEqual(f3.check_list_id, cl2.id); Assert.AreEqual(f4.check_list_id, cl2.id); Assert.AreEqual(f5.check_list_id, cl2.id); #endregion #region Color Assert.AreEqual(f1.color, _f1.FieldValues[0].Color); Assert.AreEqual(f2.color, _f2.FieldValues[0].Color); Assert.AreEqual(f3.color, _f3.FieldValues[0].Color); Assert.AreEqual(f4.color, _f4.FieldValues[0].Color); Assert.AreEqual(f5.color, _f5.FieldValues[0].Color); #endregion #region custom // Assert.AreEqual(f1.custom, _f1.FieldValues[0].Id); #endregion #region Decimal_Count Assert.AreEqual(f1.decimal_count, null); Assert.AreEqual(f2.decimal_count, null); Assert.AreEqual(f3.decimal_count, 3); Assert.AreEqual(f4.decimal_count, null); Assert.AreEqual(f5.decimal_count, null); #endregion #region Default_value Assert.AreEqual(f1.default_value, ""); Assert.AreEqual(f2.default_value, ""); Assert.AreEqual(f3.default_value, ""); Assert.AreEqual(f4.default_value, ""); Assert.AreEqual(f5.default_value, ""); #endregion #region Description CDataValue f1desc = (CDataValue)_f1.Description; CDataValue f2desc = (CDataValue)_f2.Description; CDataValue f3desc = (CDataValue)_f3.Description; CDataValue f4desc = (CDataValue)_f4.Description; CDataValue f5desc = (CDataValue)_f5.Description; Assert.AreEqual(f1.description, f1desc.InderValue); Assert.AreEqual(f2.description, f2desc.InderValue); Assert.AreEqual(f3.description, f3desc.InderValue); Assert.AreEqual(f4.description, f4desc.InderValue); Assert.AreEqual(f5.description, f5desc.InderValue); #endregion #region Displayindex Assert.AreEqual(f1.display_index, _f1.FieldValues[0].DisplayOrder); Assert.AreEqual(f2.display_index, _f2.FieldValues[0].DisplayOrder); Assert.AreEqual(f3.display_index, _f3.FieldValues[0].DisplayOrder); Assert.AreEqual(f4.display_index, _f4.FieldValues[0].DisplayOrder); Assert.AreEqual(f5.display_index, _f5.FieldValues[0].DisplayOrder); #endregion #region Dummy Assert.AreEqual(f1.dummy, 1); Assert.AreEqual(f2.dummy, 1); Assert.AreEqual(f3.dummy, 0); Assert.AreEqual(f4.dummy, 0); Assert.AreEqual(f5.dummy, 0); #endregion #region geolocation #region enabled Assert.AreEqual(f1.geolocation_enabled, 0); Assert.AreEqual(f2.geolocation_enabled, 0); Assert.AreEqual(f3.geolocation_enabled, 0); Assert.AreEqual(f4.geolocation_enabled, 0); Assert.AreEqual(f5.geolocation_enabled, 1); #endregion #region forced Assert.AreEqual(f1.geolocation_forced, 0); Assert.AreEqual(f2.geolocation_forced, 1); Assert.AreEqual(f3.geolocation_forced, 0); Assert.AreEqual(f4.geolocation_forced, 0); Assert.AreEqual(f5.geolocation_forced, 0); #endregion #region hidden Assert.AreEqual(f1.geolocation_hidden, 1); Assert.AreEqual(f2.geolocation_hidden, 0); Assert.AreEqual(f3.geolocation_hidden, 1); Assert.AreEqual(f4.geolocation_hidden, 1); Assert.AreEqual(f5.geolocation_hidden, 1); #endregion #endregion #region isNum Assert.AreEqual(f1.is_num, 0); Assert.AreEqual(f2.is_num, 0); Assert.AreEqual(f3.is_num, 0); Assert.AreEqual(f4.is_num, 0); Assert.AreEqual(f5.is_num, 0); #endregion #region Label Assert.AreEqual(f1.label, _f1.Label); Assert.AreEqual(f2.label, _f2.Label); Assert.AreEqual(f3.label, _f3.Label); Assert.AreEqual(f4.label, _f4.Label); Assert.AreEqual(f5.label, _f5.Label); #endregion #region Mandatory Assert.AreEqual(f1.mandatory, 1); Assert.AreEqual(f2.mandatory, 0); Assert.AreEqual(f3.mandatory, 1); Assert.AreEqual(f4.mandatory, 1); Assert.AreEqual(f5.mandatory, 1); #endregion #region maxLength Assert.AreEqual(f1.max_length, 55); Assert.AreEqual(f2.max_length, 5); Assert.AreEqual(f3.max_length, 8); Assert.AreEqual(f4.max_length, 666); Assert.AreEqual(f5.max_length, 69); #endregion #region min/max_Value #region max Assert.AreEqual(f1.max_value, "55"); Assert.AreEqual(f2.max_value, "5"); Assert.AreEqual(f3.max_value, "4865"); Assert.AreEqual(f4.max_value, "41153"); Assert.AreEqual(f5.max_value, "69"); #endregion #region min Assert.AreEqual(f1.min_value, "0"); Assert.AreEqual(f2.min_value, "0"); Assert.AreEqual(f3.min_value, "0"); Assert.AreEqual(f4.min_value, "0"); Assert.AreEqual(f5.min_value, "1"); #endregion #endregion #region Multi Assert.AreEqual(f1.multi, 0); Assert.AreEqual(f2.multi, 0); Assert.AreEqual(f3.multi, 0); Assert.AreEqual(f4.multi, 0); Assert.AreEqual(f5.multi, 0); #endregion #region Optional Assert.AreEqual(f1.optional, 0); Assert.AreEqual(f2.optional, 0); Assert.AreEqual(f3.optional, 1); Assert.AreEqual(f4.optional, 1); Assert.AreEqual(f5.optional, 1); #endregion #region Query_Type Assert.AreEqual(f1.query_type, null); Assert.AreEqual(f2.query_type, null); Assert.AreEqual(f3.query_type, null); Assert.AreEqual(f4.query_type, null); Assert.AreEqual(f5.query_type, null); #endregion #region Read_Only Assert.AreEqual(f1.read_only, 1); Assert.AreEqual(f2.read_only, 0); Assert.AreEqual(f3.read_only, 1); Assert.AreEqual(f4.read_only, 0); Assert.AreEqual(f5.read_only, 0); #endregion #region Selected Assert.AreEqual(f1.selected, 0); Assert.AreEqual(f2.selected, 0); Assert.AreEqual(f3.selected, 0); Assert.AreEqual(f4.selected, 1); Assert.AreEqual(f5.selected, 1); #endregion #region Split_Screen Assert.AreEqual(f1.split_screen, 0); Assert.AreEqual(f2.split_screen, 0); Assert.AreEqual(f3.split_screen, 0); Assert.AreEqual(f4.split_screen, 0); Assert.AreEqual(f5.split_screen, 0); #endregion #region Stop_On_Save Assert.AreEqual(f1.stop_on_save, 0); Assert.AreEqual(f2.stop_on_save, 0); Assert.AreEqual(f3.stop_on_save, 0); Assert.AreEqual(f4.stop_on_save, 0); Assert.AreEqual(f5.stop_on_save, 0); #endregion #region Unit_Name Assert.AreEqual(f1.unit_name, ""); Assert.AreEqual(f2.unit_name, ""); Assert.AreEqual(f3.unit_name, ""); Assert.AreEqual(f4.unit_name, ""); Assert.AreEqual(f5.unit_name, ""); #endregion #region Values Assert.AreEqual(1, _f1.FieldValues.Count()); Assert.AreEqual(1, _f2.FieldValues.Count()); Assert.AreEqual(1, _f3.FieldValues.Count()); Assert.AreEqual(1, _f4.FieldValues.Count()); Assert.AreEqual(1, _f5.FieldValues.Count()); Assert.AreEqual(field_Values1.value, _f1.FieldValues[0].Value); Assert.AreEqual(field_Values2.value, _f2.FieldValues[0].Value); Assert.AreEqual(field_Values3.value, _f3.FieldValues[0].Value); Assert.AreEqual(field_Values4.value, _f4.FieldValues[0].Value); Assert.AreEqual(field_Values5.value, _f5.FieldValues[0].Value); #endregion #region Version Assert.AreEqual(f1.version, 49); Assert.AreEqual(f2.version, 9); Assert.AreEqual(f3.version, 1); Assert.AreEqual(f4.version, 1); Assert.AreEqual(f5.version, 1); #endregion #endregion }
[Test] // Core_Template_TemplateFromXml_ReturnsTemplate() public void Core_eForm_QuickSyncEnabledeFormFromXML_ReturnseMainElement() { //Arrance string xmlstring = @" <?xml version='1.0' encoding='utf-8'?> <Main xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> <Id>35</Id> <Label>Lorem ipsum</Label> <DisplayOrder>0</DisplayOrder> <CheckListFolderName>Modtagerkontrol</CheckListFolderName> <Repeated>1</Repeated> <StartDate>2018-08-23 10:40:52</StartDate> <EndDate>2058-08-29 10:40:52</EndDate> <Language>da</Language> <MultiApproval>false</MultiApproval> <FastNavigation>false</FastNavigation> <DownloadEntities>false</DownloadEntities> <ManualSync>false</ManualSync> <EnableQuickSync>true</EnableQuickSync> <ElementList> <Element xsi:type='DataElement'> <Id>36</Id> <Label>Lorem ipsum</Label> <DisplayOrder>0</DisplayOrder> <Description><![CDATA[Lorem ipsum description]]></Description> <ApprovalEnabled>false</ApprovalEnabled> <ReviewEnabled>false</ReviewEnabled> <DoneButtonEnabled>true</DoneButtonEnabled> <ExtraFieldsEnabled>false</ExtraFieldsEnabled> <PinkBarText /> <DataItemGroupList /> <DataItemList> <DataItem xsi:type='SingleSelect'> <Id>22</Id> <Mandatory>false</Mandatory> <ReadOnly>false</ReadOnly> <Label>Is everything OK:</Label> <Description><![CDATA[]]></Description> <DisplayOrder>1</DisplayOrder> <KeyValuePairList> <KeyValuePair> <Key>1</Key> <Value>OK</Value> <Selected>false</Selected> <DisplayOrder>1</DisplayOrder> </KeyValuePair> <KeyValuePair> <Key>2</Key> <Value>Not OK</Value> <Selected>false</Selected> <DisplayOrder>2</DisplayOrder> </KeyValuePair> </KeyValuePairList> </DataItem> </DataItemList> </Element> </ElementList> <PushMessageTitle /> <PushMessageBody /> </Main>"; //Act MainElement match = sut.TemplateFromXml(xmlstring); //Assert Assert.NotNull(match); Assert.AreEqual("", match.CaseType); Assert.AreEqual(1, match.Repeated); Assert.AreEqual(1, match.Id); Assert.AreEqual("Lorem ipsum", match.Label); Assert.AreEqual("da", match.Language); Assert.AreEqual(false, match.MultiApproval); Assert.AreEqual(false, match.FastNavigation); Assert.AreEqual(0, match.DisplayOrder); Assert.AreEqual(1, match.ElementList.Count()); Assert.AreEqual(true, match.EnableQuickSync); DataElement dE = (DataElement)match.ElementList[0]; Assert.AreEqual(dE.DataItemList.Count(), 1); Assert.AreEqual("Lorem ipsum", dE.Label); CDataValue cd = new CDataValue(); //Assert.AreEqual(dE.Description, cd); TODO Assert.AreEqual(0, dE.DisplayOrder); Assert.AreEqual(false, dE.ReviewEnabled); //Assert.AreEqual(dE.ManualSync) //TODO No Method for ManualSync Assert.AreEqual(false, dE.ExtraFieldsEnabled); //Assert.AreEqual(dE.DoneButtonDisabled, false); //TODO DoneButtonDisabled no method found Assert.AreEqual(false, dE.ApprovalEnabled); SingleSelect commentField = (SingleSelect)dE.DataItemList[0]; Assert.AreEqual("Is everything OK:", commentField.Label); //Assert.AreEqual(commentField.Description, cd); Assert.AreEqual(1, commentField.DisplayOrder); //Assert.AreEqual(commentField.Multi, 0) //TODO No method MULTI //Assert.AreEqual(commentField.geolocation, false) //TODO no method geolocation //Assert.AreEqual(commentField.Split, false) //TODO no method Split //Assert.AreEqual("", commentField.Value); Assert.AreEqual(false, commentField.ReadOnly); Assert.AreEqual(false, commentField.Mandatory); //Assert.AreEqual(Constants.FieldColors.Grey, commentField.Color); }