public async Task TestPutStockItemAsyncRequired() { // Arrange var dbContext = DbContextMocker.GetWideWorldImportersDbContext(nameof(TestPutStockItemAsyncRequired)); var controller = new WarehouseController(null, dbContext); var id = 12; var request = new PutStockItemsRequest { StockItemName = "USB food flash drive (Update)", SupplierID = null, ColorID = 12, UnitPrice = 3 }; // Act var response = await controller.PutStockItemAsync(id, request) as ObjectResult; var value = response.Value as IResponse; dbContext.Dispose(); // Assert Assert.False(value.DidError); var badRequestResult = Assert.IsType <BadRequestObjectResult>(value); Assert.IsType <SerializableError>(badRequestResult.Value); }
// Start is called before the first frame update void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <FirstPersonGunController>(); warehouse = GameObject.FindGameObjectWithTag("Warehouse").GetComponentInChildren <WarehouseController>(); gameManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>(); //discriptionText.enabled = false; }
/// <summary> /// Initializes a new instance of the <see cref="T:UserDetails"/> class. /// </summary> /// <param name="membershipUser">The membership user.</param> /// <param name="getProfile">if set to <c>true</c> [get profile].</param> public UserDetails(MembershipUser membershipUser, bool getProfile) { if (membershipUser != null) { UserName = membershipUser.UserName; Email = membershipUser.Email; LastActivityDate = membershipUser.LastActivityDate.ToShortDateString(); if (getProfile) { ProfileCommon p = new ProfileCommon(); ProfileCommon profile = p.GetProfile(membershipUser.UserName); if (profile != null) { OpCoId = profile.OpCoId; OpCoCode = profile.OpCoCode; RegionId = profile.RegionId; RegionCode = profile.RegionCode; WarehouseId = profile.WarehouseId; SalesLocationId = profile.SalesLocationId; SalesLocation = SalesLocationController.GetLocation(salesLocationId, false); OpCo = OpcoController.GetOpCo(OpCoId, false); Warehouse = WarehouseController.GetWarehouse(WarehouseId); Region = OptrakRegionController.GetRegion(RegionId); } } } }
public async Task TestAddProductAsync() { // Arrange var dbContext = DbContextMocker.GetStoreDbContext(nameof(TestAddProductAsync)); var service = ServiceMocker.GetWarehouseService(dbContext); var controller = new WarehouseController(service, null); var request = new AddProductRequest { ProductID = 100, ProductName = "Coca Cola Zero 24 fl Oz Bottle Special Edition", ProductDescription = "Enjoy Coca-Cola’s crisp.", Price = 2.15m }; controller.MockControllerContext(); // Act var response = await controller.AddProductAsync(request) as ObjectResult; var value = response.Value as ISingleResponse <AddProductRequest>; service.Dispose(); // Assert Assert.False(value?.DidError); }
protected static void SetUserDefaultWarehouse(ListControl listControl, ProfileCommon profile) { //default the warehouse dropdown to the current users warehouse if (profile.WarehouseId > 0) { ListItem defaultItem = new ListItem(); if (listControl.DataValueField == "Code") { Warehouse warehouse = WarehouseController.GetWarehouse(profile.WarehouseId); if (warehouse != null) { defaultItem = listControl.Items.FindByValue(warehouse.Code); } } else { defaultItem = listControl.Items.FindByValue(profile.WarehouseId.ToString()); } if (defaultItem != null) { if (listControl.SelectedItem != null) { listControl.SelectedItem.Selected = false; } defaultItem.Selected = true; } } }
/// <summary> /// Processes the request. /// </summary> /// <param name="requestMessage">The request message.</param> public override void ProcessRequest(RequestMessage requestMessage) { Trip.SetTripSchema(textFieldParser.TextFields); //get all warehouse objects in one hit for performance allWarehouses = WarehouseController.GetWarehouses(false); //get all regions in one hit for performance allRegions = OptrakRegionController.GetRegions(); try { textFieldParser.FirstLineIsHeader = true; textFieldParser.FileType = TextFieldParser.FileFormat.Delimited; textFieldParser.Delimiter = '|'; textFieldParser.TrimWhiteSpace = true; // Set up event handlers for when a row is read and when a row is read but failes to match the expected schema textFieldParser.RecordFound += new TextFieldParser.RecordFoundHandler(textParser_RecordFound); textFieldParser.RecordFailed += new TextFieldParser.RecordFailedHandler(RecordFailed); // parse the message textFieldParser.ParseFileContents(requestMessage.Body); // Processed Status = SaveTrips(); } catch (Exception ex) { // Store the exception LastError = ex; // Failed Status = SubscriberStatusEnum.Failed; } }
private void PopulateWarehouses() { // Get the region drop down DropDownList dropDownListRegion = GetControl <DropDownList>("ddlRegion", PageFormView); DropDownList dropDownListWarehouse = GetControl <DropDownList>("ddlWarehouse", PageFormView); dropDownListWarehouse.Items.Clear(); if (dropDownListRegion.SelectedIndex > 0) { // Populate the list of regions try { dropDownListWarehouse.DataSource = WarehouseController.GetWarehousesByRegion(Convert.ToInt32(dropDownListRegion.SelectedItem.Value)); } catch (Exception ex) { if (ExceptionPolicy.HandleException(ex, "User Interface")) { DisplayMessage("Failed to retrieve Warehouses"); } } dropDownListWarehouse.DataBind(); } // Now add the all dropDownListWarehouse.Items.Insert(0, new ListItem("All", "-1")); // Enable the warehouse drop down dropDownListWarehouse.Enabled = (dropDownListWarehouse.Items.Count > 1); }
internal Trip PopulateNewItem() { Trip trip = new Trip(); trip.StartDate = DateTime.Today; trip.TripNumber = "12345678"; Warehouse warehouse = WarehouseTests.PopulateNewItem(); trip.WarehouseId = WarehouseController.SaveWarehouse(warehouse); trip.LeaveTime = DateTime.Now.ToShortTimeString(); trip.FinishTime = DateTime.Now.AddMinutes(10).ToShortTimeString(); trip.PeakWeight = 1; trip.PeakVolume = 2; trip.MaximumLoadWeight = 1; trip.MaximumLoadVolume = 2; trip.VehicleCost = 99; trip.RegionId = warehouse.RegionId; trip.VehicleRegistration = "NN56 TDC"; trip.AssignedDriver = "TDC AssignedDriver"; trip.TotalDistance = 100; //trip.LoadingTime = 20; //trip.TravellingTime = 30; //trip.WaitingTime = 40; trip.UpdatedBy = "TDC Team"; return(trip); }
public void Initializer() { //New up everytime the test runs _mockContext = new Mock<StoreContext>(); _mockSetStoragePlace = new Mock<DbSet<StoragePlace>>(); _mockSetWarehouse = new Mock<DbSet<Warehouse>>(); //Add data var dataWarehouse = ResourceData.Warehouses.AsQueryable(); var dataStoragePlace = ResourceData.StoragePlaces.AsQueryable(); //Setup behavior var setupDbWh = Helper.SetupDb(_mockSetWarehouse, dataWarehouse); var setupDbSp = Helper.SetupDb(_mockSetStoragePlace, dataStoragePlace); _mockContext.Setup(x => x.Warehouses).Returns(setupDbWh.Object); _mockContext.Setup(x => x.StoragePlaces).Returns(setupDbSp.Object); //This will make the mock version of the db approve any string given to the include method. //Without this you will get null reference exception when calling include. _mockSetWarehouse.Setup(x => x.Include(It.IsAny<string>())).Returns(_mockSetWarehouse.Object); _mockSetStoragePlace.Setup(x => x.Include(It.IsAny<string>())).Returns(_mockSetStoragePlace.Object); //Inject mock data via overload constructor var dbWarehouseRepository = new DbWarehouseRepository(_mockContext.Object); var dbStoragePlaceRepository = new DbStoragePlaceRepository(_mockContext.Object); //Setup fakerepo via overloaded constructor _warehouseController = new WarehouseController(dbWarehouseRepository, dbStoragePlaceRepository); }
public async Task TestPostStockItemAsync() { // Arrange var dbContext = DbContextMocker.GetWideWorldImportersDbContext(nameof(TestPostStockItemAsync)); var controller = new WarehouseController(null, dbContext); var request = new PostStockItemsRequest { StockItemID = 100, StockItemName = "USB anime flash drive - Goku", SupplierID = 12, UnitPackageID = 7, OuterPackageID = 7, LeadTimeDays = 14, QuantityPerOuter = 1, IsChillerStock = false, TaxRate = 15.000m, UnitPrice = 32.00m, RecommendedRetailPrice = 47.84m, TypicalWeightPerUnit = 0.050m, CustomFields = "{ \"CountryOfManufacture\": \"Japan\", \"Tags\": [\"32GB\",\"USB Powered\"] }", Tags = "[\"32GB\",\"USB Powered\"]", SearchDetails = "USB anime flash drive - Goku", LastEditedBy = 1, ValidFrom = DateTime.Now, ValidTo = DateTime.Now.AddYears(5) }; // Act var response = await controller.PostStockItemAsync(request) as ObjectResult; var value = response.Value as ISingleResponse <StockItem>; dbContext.Dispose(); // Assert Assert.False(value.DidError); }
private void Limpiar() { WarehouseController wareCont = new WarehouseController(); grdcList.DataSource = wareCont.getWarehouse(); txtName.Text = ""; }
private void PopulateTDCDeliveryWarehouses(string opCo) { // Populate the delivery warehouses for TDC Shipment option ddlDeliveryWarehouse.DataSource = WarehouseController.GetTDCDeliveryWarehouseCodes(opCo); ddlDeliveryWarehouse.Items.Clear(); ddlDeliveryWarehouse.Items.Add(new ListItem("All", "-1")); ddlDeliveryWarehouse.DataBind(); }
private void Awake() { if (Instance == null) { Instance = this; } UniversalTool.ReadyUIAnimTwo(transform.Find("Box").GetComponent <CanvasGroup>(), transform.Find("Box")); }
private void button1_Click(object sender, EventArgs e) { wc = new WarehouseController(); wc.OpenWarehouse(); var cell = wc.GetCell(2, 3, 4); wc.CloseWarehouse(); }
public CreatePartTest() { warehouseService = new Mock <IWarehouseService>(); warehouseController = new WarehouseController(warehouseService.Object); part = new Part { Id = partId }; }
private void button2_Click(object sender, EventArgs e) { wc = new WarehouseController(); if (EthernetPort.InsureTcpPort(wc.ServerPort) && EthernetPort.InsureFirewall("Kenmec-Warehouse", this.wc.ServerPort)) { wc.StartServer(); } }
public void Item_TryDeleteItem() { var product = ProductUsedForTesting(); var MockRequest = new Mock <IApiRequestSend <Warehouse> >(); var itemController = new WarehouseController(MockRequest.Object); itemController.DeleteWarehouseProduct(product); MockRequest.Verify(m => m.DeleteEntity(product), Times.Once); }
public void Item_TryModifyItem() { var item = ProductUsedForTesting(); var MockRequest = new Mock <IApiRequestSend <Warehouse> >(); var itemController = new WarehouseController(MockRequest.Object); itemController.EditWarehouseProduct(item.Id, item); MockRequest.Verify(m => m.ModifyEntity(item.Id, item), Times.Once); }
[Fact] // GetAllData_CallsGetAllDataOnce public void Data_TryGetAllData() { var MockRequest = new Mock <IApiRequestSend <Warehouse> >(); var itemController = new WarehouseController(MockRequest.Object); itemController.GetAll(); MockRequest.Verify(m => m.GetAllData(), Times.Once()); }
private void spIdAlmacen_EditValueChanged(object sender, EventArgs e) { if (spIdAlmacen.Value > 0) { Warehouse oWarehouse = new Warehouse(); WarehouseController wareCont = new WarehouseController(); oWarehouse = wareCont.getWarehouseXId((int)spIdAlmacen.Value); txtName.Text = "" + oWarehouse.Name; } }
private static WarehouseController BuildControlller(Mock <IWarehouseService> mockService) { var controller = new WarehouseController(mockService.Object) { Request = new HttpRequestMessage(), Configuration = new HttpConfiguration() }; return(controller); }
private void PopulateOpCoWarehouses() { // Populate the stock warehouse from the opco shipment table ddlStockWarehouse.DataSource = WarehouseController.GetOpCoStockWarehouseCodes(""); ddlStockWarehouse.DataBind(); //Populate the delivery warehouse from the opco shipment table //ddlDeliveryWarehouse.DataSource = WarehouseController.GetOpCoDeliveryWarehouseCodes(""); //ddlDeliveryWarehouse.DataBind(); PopulateOpCoDeliveryWarehouses(""); }
private void PopulateTDCWarehouses() { // Populate the stock warehouse from warehouse table List <Warehouse> allWarehouses = WarehouseController.GetWarehouses(false); ddlStockWarehouse.DataSource = allWarehouses; ddlStockWarehouse.DataBind(); // Populate the delivery warehouse from warehouse table //ddlDeliveryWarehouse.DataSource = allWarehouses; //ddlDeliveryWarehouse.DataBind(); PopulateTDCDeliveryWarehouses(""); }
public void SaveItemsOneRegionOneWarehouseWeekend() { using (TransactionScope ts = new TransactionScope()) { NonWorkingDay nonWorkingDay = PopulateNewItem(); Warehouse warehouse = WarehouseController.GetWarehouse(nonWorkingDay.WarehouseId); int regionId = warehouse.RegionId; bool weekendOnly = true; int Id = SaveItemsWithinRange(nonWorkingDay, regionId, nonWorkingDay.WarehouseId, weekendOnly); Assert.IsTrue(Id != 0); } }
public void TestGetItemsByRegion() { using (TransactionScope ts = new TransactionScope()) { NonWorkingDay nonWorkingDay = PopulateNewItem(); nonWorkingDay.Id = SaveItem(nonWorkingDay); if (nonWorkingDay.Id != -1) { Warehouse warehouse = WarehouseController.GetWarehouse(nonWorkingDay.WarehouseId); Assert.IsNotNull(GetItemsByRegion(warehouse.RegionId)); } } }
public async Task TestGetStockItemsAsync() { // Arrange var dbContext = DbContextMocker.GetWideWorldImportersDbContext(nameof(TestGetStockItemAsync)); var controller = new WarehouseController(null, dbContext); // Act var response = await controller.GetStockItemsAsync() as ObjectResult; var value = response.Value as IPagedResponse <StockItem>; dbContext.Dispose(); // Assert Assert.False(value.DidError); }
public async Task TestGetStockItemsAsync() { // Arrange var repository = RepositoryMocker.GetWarehouseRepository(nameof(TestGetStockItemsAsync)); var controller = new WarehouseController(null, repository); // Act var response = await controller.GetStockItemsAsync() as ObjectResult; var value = response.Value as IPagedResponse <StockItem>; repository.Dispose(); // Assert Assert.False(value.DidError); }
void OnEnable() { animator = GetComponent <Animator>(); boxCollider = GetComponent <BoxCollider>(); capsuleCollider = transform.Find("Head").gameObject.GetComponent <CapsuleCollider>(); rigidbody = GetComponent <Rigidbody>(); agent = GetComponent <NavMeshAgent>(); audiosource = GetComponent <AudioSource>(); target = GameObject.FindGameObjectWithTag(targetTag).transform; targetPlayer = GameObject.FindGameObjectWithTag("Player").transform; gameManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>(); player = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <FirstPersonGunController>(); warehouse = GameObject.FindGameObjectWithTag("Warehouse").GetComponentInChildren <WarehouseController>(); InitCharacter(); }
/// <summary> /// Populates the new item. /// </summary> /// <returns></returns> internal NonWorkingDay PopulateNewItem() { NonWorkingDay nonWorkingDay = new NonWorkingDay(); nonWorkingDay.NonWorkingDate = DateTime.Today; nonWorkingDay.Description = DateTime.Today.DayOfWeek.ToString(); nonWorkingDay.UpdatedDate = DateTime.Today; nonWorkingDay.UpdatedBy = "TDC Team"; Warehouse warehouse = WarehouseTests.PopulateNewItem(); nonWorkingDay.WarehouseCode = warehouse.Code; nonWorkingDay.WarehouseId = WarehouseController.SaveWarehouse(warehouse); return(nonWorkingDay); }
public async Task TestGetProductsTestAsync() { // Arrange var logger = LoggingHelper.GetLogger <WarehouseController>(); var service = ServiceMocker.GetWarehouseService(nameof(TestGetProductsTestAsync)); var controller = new WarehouseController(logger, service); // Act var response = await controller.GetProductsAsync() as ObjectResult; var value = response.Value as IPagedResponse <Product>; service.Dispose(); // Assert Assert.False(value.DidError); Assert.True(value.Model.Count() > 0); }