public static SlotCabinetRegistration BuildFor(SlotCabinet slotCabinet, bool addRegisterEvent = true, Action <SlotCabinetRegistration> customize = null) { var slotCabinetRegistration = new SlotCabinetRegistration { MacAddress = Utils.SampleMacAddress(), SasVersion = "SasVersion", SlotCabinetId = slotCabinet.SlotCabinetId, RegistrationDateTime = SliceFixture.GetSystemDateTime(), }; customize?.Invoke(slotCabinetRegistration); slotCabinet.SlotCabinetRegistrations.Add(slotCabinetRegistration); if (addRegisterEvent) { //auto add a register cabinet event on new cabinet registration addition var slotCabinetEvent = SlotCabinetEventBuilderNew.BuildFor(slotCabinetRegistration, sce => { sce.EventTypeId = (int)SlotEventType.RegisterCabinet; }); slotCabinetRegistration.SlotCabinetEvents.Add(slotCabinetEvent); } return(slotCabinetRegistration); }
public static SlotCabinet Build(Action <SlotCabinet> customize = null) { var nextNumber = Utils.GetNextNaturalNumber(); var slotCabinet = new SlotCabinet { SlotCabinetId = Guid.NewGuid(), HouseNumber = (ushort?)nextNumber, AssetNumber = Utils.NextAssetNumber(), LogicBoardSerialNumber = Utils.NextLogicBoardSerialNumber().ToString(), SlotCabinetManufactureId = Utils.GetRandomSlotCabinetManufacturerId(), Description = $"Description{nextNumber}", SlotCabinetStyleId = Utils.GetRandomSlotCabinetStyleId(), SlotCabinetTypeId = Utils.GetRandomSlotCabinetTypeId(), IsActive = nextNumber % 2 == 0, //TODO:RR: default to true? SiteCode = 0 }; customize?.Invoke(slotCabinet); return(slotCabinet); }