Ejemplo n.º 1
0
 public void Setup()
 {
     _continuation = new Continuation {Success = true};
     _validTask = ObjectMother.ValidTask("raif");
     _validTask.QuantityUsed = 5;
     _crudManager = MockRepository.GenerateMock<ICrudManager>();
     _crudManager.Expect(x => x.Finish()).Return(new Notification());
     _saveEntityService = MockRepository.GenerateMock<ISaveEntityService>();
     _sesCatcher = _saveEntityService.CaptureArgumentsFor(x => x.ProcessSave(_validTask.InventoryProduct, _crudManager), x => x.Return(_crudManager));
     _SUT = new InventoryService(null,_saveEntityService);
     _SUT.DecrementTaskProduct(_validTask, _crudManager);
 }
Ejemplo n.º 2
0
 public void ReserveInventory(ShoppingCart cart)
 {
     foreach (var item in cart.OrderItems)
     {
         try
         {
             var inventoryService = new InventoryService();
             inventoryService.Reserve(item.Description, item.Quantity);
         }
         catch (InsufficientInventoryException ex)
         {
             throw new OrderException(
                       "Insufficient inventory for item " +
                       item.Description, ex);
         }
     }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            IInventoryService service = new InventoryService();
            Customer          cust    = new Customer(service)
            {
                CustomerId      = 1,
                CustomerName    = "Raja",
                Address         = "Chennai",
                CustomerContact = "98406"
            };

            var result = cust.Create();

            Console.WriteLine(result);
            Console.ReadLine();
        }
Ejemplo n.º 4
0
        public async Task WhenAtLeastOneInstanceHasInventoryData_ThenListProjectInventoryAsyncSucceeds(
            [WindowsInstance(
                 InitializeScript = PublishInventoryScript)] ResourceTask <InstanceLocator> testInstance,
            [Credential(Role = PredefinedRole.ComputeViewer)] ResourceTask <ICredential> credential)
        {
            // Make sure there is at least one instance.
            var instanceRef = await testInstance;
            var service     = new InventoryService(
                new ComputeEngineAdapter(await credential));

            var info = await service.ListProjectInventoryAsync(
                TestProject.ProjectId, CancellationToken.None);

            Assert.IsNotNull(info);
            Assert.GreaterOrEqual(info.Count(), 1);
        }
Ejemplo n.º 5
0
        public void AddToInventory_GivenANewItem_AddsToDatabase()
        {
            // arrange
            InventoryItem item = new InventoryItem()
            {
                ID = 100
            };
            Mock <IInventoryItemRepository> mockInventoryRepo = new Mock <IInventoryItemRepository>();
            InventoryService sut = new InventoryService(mockInventoryRepo.Object, null, null, null, null);

            // act
            sut.AddToInventory(item);

            // assert
            mockInventoryRepo.Verify(r => r.AddToInventory(It.Is <InventoryItem>(i => i.ID == 100)), Times.Once());
        }
Ejemplo n.º 6
0
 public void Init(GameObject _player, WorldManager _worldManager, int[,] _wallTilesMap, int[,] _tilesWorldMap, GameObject[,] _tilesObjetMap)
 {
     worldManager     = _worldManager;
     inventoryService = GameObject.FindGameObjectWithTag("InventoryContainer").GetComponent <InventoryService>();
     player           = _player;
     cam           = player.GetComponentInChildren <Camera>();
     tile_dig_1    = gameObject.transform.GetChild(0).gameObject;
     tile_dig_2    = gameObject.transform.GetChild(1).gameObject;
     tile_dig_3    = gameObject.transform.GetChild(2).gameObject;
     selector      = gameObject.transform.GetChild(3).gameObject;
     spriteRender  = selector.GetComponent <SpriteRenderer>();
     wallTilesMap  = _wallTilesMap;
     tilesWorldMap = _tilesWorldMap;
     tilesObjetMap = _tilesObjetMap;
     StartCoroutine("InitSelector");
 }
Ejemplo n.º 7
0
        public async Task TestCreateAndIsItemInInventoryAsync()
        {
            MockReliableStateManager stateManager = new MockReliableStateManager();
            InventoryService         target       = new InventoryService(stateManager);

            InventoryItem expected = new InventoryItem("test", 1, 10, 1, 10);

            await target.CreateInventoryItemAsync(expected);

            bool resultTrue = await target.IsItemInInventoryAsync(expected.Id);

            bool resultFalse = await target.IsItemInInventoryAsync(new InventoryItemId());

            Assert.IsTrue(resultTrue);
            Assert.IsFalse(resultFalse);
        }
Ejemplo n.º 8
0
 public IActionResult GetMaterialBatch(Guid id)
 {
     try
     {
         MaterialBatch batch = InventoryService.GetMaterialBatch(id);
         return(Ok(batch));
     }
     catch (MaterialBatchNotFoundException exception)
     {
         return(HandleResourceNotFoundException(exception));
     }
     catch (Exception exception)
     {
         return(HandleUnexpectedException(exception));
     }
 }
Ejemplo n.º 9
0
        public AdUnit FindRootAdUnit(DfpUser user)
        {
            // Get InventoryService.
            InventoryService inventoryService =
                (InventoryService)user.GetService(DfpService.v201308.InventoryService);

            // Create a Statement to only select the root ad unit.
            Statement statement = new Statement();

            statement.query = "WHERE parentId IS NULL LIMIT 500";

            // Get ad units by Statement.
            AdUnitPage page = inventoryService.getAdUnitsByStatement(statement);

            return(page.results[0]);
        }
Ejemplo n.º 10
0
        public void IncreaseInventory_ArticleWasNotInStockBefore_Success()
        {
            //arrange
            var shop = ProductAssemblyShop.DeepCopy();

            shop.Inventory = new HashSet <InventoryItem>();
            var item = new InventoryItem(Product1InteriorDoor, 5);

            //act
            InventoryService.IncreaseInventory(item, shop);

            //assert
            var actual = shop.Inventory.Of(Product1InteriorDoor).Amount;

            Assert.That(actual, Is.EqualTo(item.Amount));
        }
Ejemplo n.º 11
0
 public IActionResult GetLastMaterialBatchTransactionLogEntry(Guid batchId)
 {
     try
     {
         Transaction transaction = InventoryService.GetLastMaterialBatchTransaction(batchId);
         return(Ok(transaction));
     }
     catch (MaterialBatchNotFoundException exception)
     {
         return(HandleResourceNotFoundException(exception));
     }
     catch (Exception exception)
     {
         return(HandleUnexpectedException(exception));
     }
 }
Ejemplo n.º 12
0
        public async Task TestRemoveStock()
        {
            int expectedQuantity = 5;
            int quantityToRemove = 3;
            MockReliableStateManager stateManager = new MockReliableStateManager();
            InventoryService         target       = new InventoryService(stateManager);

            InventoryItem item = new InventoryItem("test", 1, expectedQuantity + quantityToRemove, 1, expectedQuantity);

            await target.CreateInventoryItemAsync(item);

            int actualRemoved = await target.RemoveStockAsync(item.Id, quantityToRemove, CustomerOrderActorMessageId.GetRandom());

            Assert.AreEqual(quantityToRemove, actualRemoved);
            Assert.AreEqual(expectedQuantity, item.AvailableStock);
        }
Ejemplo n.º 13
0
        public void AddInventoryWithoutProduct()
        {
            var mock   = new Mock <IInventoryRepository>();
            var newInv = new Inventory()
            {
                ProductStock = null
            };

            mock.Setup(p => p.AddInventory(It.IsAny <Inventory>()))
            .Returns(newInv);

            var service = new InventoryService(mock.Object);
            var repInv  = service.AddInventory(newInv);

            Assert.IsTrue(repInv == null);
        }
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public override void Run(DfpUser user)
        {
            // Get the InventoryService.
            InventoryService inventoryService =
                (InventoryService)user.GetService(DfpService.v201511.InventoryService);

            // Get the NetworkService.
            NetworkService networkService =
                (NetworkService)user.GetService(DfpService.v201511.NetworkService);

            // Set the parent ad unit's ID for all ad units to be created under.
            String effectiveRootAdUnitId = networkService.getCurrentNetwork().effectiveRootAdUnitId;

            // Create local ad unit object.
            AdUnit adUnit = new AdUnit();

            adUnit.name         = "Mobile_Ad_Unit";
            adUnit.parentId     = effectiveRootAdUnitId;
            adUnit.description  = "Ad unit description.";
            adUnit.targetWindow = AdUnitTargetWindow.BLANK;

            // Create ad unit size.
            AdUnitSize adUnitSize = new AdUnitSize();
            Size       size       = new Size();

            size.width                 = 400;
            size.height                = 300;
            size.isAspectRatio         = false;
            adUnitSize.size            = size;
            adUnitSize.environmentType = EnvironmentType.BROWSER;

            // Set the size of possible creatives that can match this ad unit.
            adUnit.adUnitSizes = new AdUnitSize[] { adUnitSize };

            try {
                // Create the ad unit on the server.
                AdUnit[] createdAdUnits = inventoryService.createAdUnits(new AdUnit[] { adUnit });

                foreach (AdUnit createdAdunit in createdAdUnits)
                {
                    Console.WriteLine("An ad unit with ID \"{0}\" was created under parent with ID " +
                                      "\"{1}\".", createdAdunit.id, createdAdunit.parentId);
                }
            } catch (Exception e) {
                Console.WriteLine("Failed to create ad units. Exception says \"{0}\"", e.Message);
            }
        }
Ejemplo n.º 15
0
        public void GetInventoryByRegion_ResultNotExistsInCache_FetchesTheResultFromDatabase()
        {
            // arrange
            List <InventoryItem> expected = new List <InventoryItem>();

            expected.Add(new InventoryItem()
            {
                ID = 1
            });
            expected.Add(new InventoryItem()
            {
                ID = 2
            });
            expected.Add(new InventoryItem()
            {
                ID = 3
            });
            List <Warehouse> warehouses = new List <Warehouse>();

            warehouses.Add(new Warehouse()
            {
                ID = 33
            });
            warehouses.Add(new Warehouse()
            {
                ID = 22
            });
            Mock <ObjectCache>      mockCache           = new Mock <ObjectCache>();
            Mock <ILocationService> mockLocationService = new Mock <ILocationService>();

            mockLocationService.Setup(s => s.GetWarehousesByRegion("WesternCanada")).Returns(warehouses);
            Mock <IInventoryItemRepository> mockInventoryRepo = new Mock <IInventoryItemRepository>();

            mockInventoryRepo.Setup(r => r.GetInventories(It.Is <IEnumerable <Warehouse> >(l => l.Count() == 2)))
            .Returns(expected);
            InventoryService sut = new InventoryService(mockInventoryRepo.Object, null, null,
                                                        mockCache.Object, mockLocationService.Object);

            // act
            var actual = sut.GetInventoryByRegion("WesternCanada");

            // assert
            Assert.IsTrue(Equality.AreEqual(expected, actual));
            mockLocationService.Verify(s => s.GetWarehousesByRegion("WesternCanada"), Times.Once());
            mockInventoryRepo.Verify(r => r.GetInventories(It.Is <IEnumerable <Warehouse> >(l => l.Count() == 2)),
                                     Times.Once());
        }
Ejemplo n.º 16
0
        public async void CanGetAllProduct()
        {
            DbContextOptions <NurseryDbContext> options = new DbContextOptionsBuilder <NurseryDbContext>().UseInMemoryDatabase("check2").Options;

            using (NurseryDbContext context = new NurseryDbContext(options))
            {
                InventoryService inventoryService = new InventoryService(context);
                Product          product          = new Product();
                await inventoryService.CreateProduct(product);

                var expected = await inventoryService.GetAllProducts();

                Assert.Equal(new List <Product> {
                    product
                }, expected);
            }
        }
Ejemplo n.º 17
0
        public IActionResult PerformMaterialTransaction(Guid batchId, [FromBody] TransactionRequest transactionRequest)
        {
            if (transactionRequest == null)
            {
                return(HandleBadRequest("No or invalid transaction data supplied."));
            }

            // Validate quantity value
            if (transactionRequest.Quantity <= 0)
            {
                return(HandleBadRequest("The quantity of a material transaction needs to be greater than 0."));
            }

            // Attempt to perform the transaction
            try
            {
                string userId = null;
                if (transactionRequest.UserId == null)
                {
                    userId = GetSubject();
                }
                else
                {
                    userId = transactionRequest.UserId;
                }
                double      quantity    = transactionRequest.IsCheckout ? transactionRequest.Quantity * -1 : transactionRequest.Quantity;
                Transaction transaction = InventoryService.PerformMaterialTransaction(batchId, quantity, userId);
                return(Ok(transaction));
            }
            catch (MaterialBatchNotFoundException exception)
            {
                return(HandleResourceNotFoundException(exception));
            }
            catch (UnauthorizedAccessException)
            {
                return(Forbid());
            }
            catch (ArgumentException exception)
            {
                return(HandleBadRequest(exception.Message));
            }
            catch (Exception exception)
            {
                return(HandleUnexpectedException(exception));
            }
        }
Ejemplo n.º 18
0
        public FormStockExport()
        {
            InitializeComponent();

            _orderExportService       = new OrderExportService();
            _employeeService          = new EmployeeService();
            _productService           = new ProductService();
            _stockService             = new StockService();
            _unitService              = new UnitService();
            _orderExportDetailService = new OrderExportDetailService();
            _inventoryService         = new InventoryService();

            LoadGirdLookUpEmployees();
            LoadGirdLookUpProducts();
            LoadGirdLookUpStocks();
            LoadGirdLookUpUnits();
        }
Ejemplo n.º 19
0
    private void Start()
    {
        slot             = Resources.Load <Sprite>("Sprites/Cells/slot");
        selectedSlot     = Resources.Load <Sprite>("Sprites/Cells/slot_selected");
        inventoryService = GetComponentInParent <InventoryService>();
        cells            = new Dictionary <int, GameObject>();
        currentPos       = 0;
        var i = 0;

        foreach (Transform child in transform)
        {
            cells[i] = child.gameObject;
            i++;
        }
        cells[0].GetComponent <Image>().sprite = selectedSlot;
        inventoryService.seletedItem           = cells[0].transform.GetChild(0).gameObject.GetComponent <InventoryItem>();
    }
Ejemplo n.º 20
0
        public JsonResult GenerateInventory(string token)
        {
            long operatorID = 0;

            if (CurrentUser != null)
            {
                operatorID = CurrentUser.UserID;
            }
            List <ImportInventoryEntity> list = Cache.Get <List <ImportInventoryEntity> >(token);
            int result = 0;

            if (list != null && list.Count > 0)
            {
                result = InventoryService.insertInventory(list, operatorID);
            }
            return(Json(result));
        }
Ejemplo n.º 21
0
        public async void CanDeleteProduct()
        {
            DbContextOptions <NurseryDbContext> options = new DbContextOptionsBuilder <NurseryDbContext>().UseInMemoryDatabase("check3").Options;

            using (NurseryDbContext context = new NurseryDbContext(options))
            {
                InventoryService inventoryService = new InventoryService(context);
                Product          product          = new Product();
                await inventoryService.CreateProduct(product);

                await inventoryService.DeleteProductByID(product.ID);

                var expected = await inventoryService.GetProductByID(product.ID);

                Assert.Null(expected);
            }
        }
Ejemplo n.º 22
0
 public IActionResult GetMaterialBatches(
     [FromQuery] int page            = 0,
     [FromQuery] int elementsPerPage = 10,
     [FromQuery] int?materialId      = null,
     [FromQuery] Guid?siteId         = null)
 {
     try
     {
         IEnumerable <MaterialBatch> batches          = InventoryService.GetMaterialBatches(materialId, siteId);
         IEnumerable <MaterialBatch> paginatedBatches = batches.Skip((page - 1) * elementsPerPage).Take(elementsPerPage);
         return(Ok(new PaginatedResponse(paginatedBatches, batches.Count())));
     }
     catch (Exception exception)
     {
         return(HandleUnexpectedException(exception));
     }
 }
Ejemplo n.º 23
0
        public void DecreaseInventory_FailFor_InSufficientInventory()
        {
            //arrange
            var shop = ProductAssemblyShop.DeepCopy();

            shop.Inventory = new HashSet <InventoryItem>()
            {
                new InventoryItem(Product1InteriorDoor, 3)
            };
            var item = new InventoryItem(Product1InteriorDoor, 5);

            //assert () => act
            var ex = Assert.Throws <DomainException>(() => InventoryService.DecreaseInventory(item, shop));

            Assert.That(ex.Message,
                        Is.EqualTo(InsufficientInventory(item.Article, item.Amount, shop.Inventory.First().Amount)));
        }
Ejemplo n.º 24
0
        public async Task WhenOsMismatches_ThenListZoneInventoryAsyncExcludesInstance(
            [WindowsInstance(
                 InitializeScript = PublishInventoryScript)] ResourceTask <InstanceLocator> testInstance,
            [Credential(Role = PredefinedRole.ComputeViewer)] ResourceTask <ICredential> credential)
        {
            // Make sure there is at least one instance.
            var instanceRef = await testInstance;
            var service     = new InventoryService(
                new ComputeEngineAdapter(await credential));

            var info = await service.ListZoneInventoryAsync(
                new ZoneLocator(TestProject.ProjectId, instanceRef.Zone),
                OperatingSystems.Linux,
                CancellationToken.None);

            Assert.IsFalse(info.ToList().Where(i => i.Instance == instanceRef).Any());
        }
        public void RemoveCard_ValidInputs_CardRemovedSuccessfully()
        {
            //arrange
            var          inventoryId = Guid.NewGuid().ToString();
            const string CardId      = "1-001";
            var          repository  = new Mock <IInventoryRepository>();

            repository.Setup(r => r.GetInventory(inventoryId)).Returns(new Inventory(inventoryId, new List <Card>()));

            //act
            var inventoryService = new InventoryService(repository.Object);

            inventoryService.RemoveCard(inventoryId, CardId);

            //assert
            repository.Verify(r => r.RemoveCard(inventoryId, CardId), Times.Once);
        }
Ejemplo n.º 26
0
        public async Task WhenAtLeastOneInstanceHasInventoryData_ThenListProjectInventoryAsyncSucceeds(
            [WindowsInstance(
                 InitializeScript = PublishInventoryScript)] ResourceTask <InstanceLocator> testInstance,
            [Credential(Role = PredefinedRole.ComputeViewer)] ResourceTask <ICredential> credential)
        {
            // Make sure there is at least one instance.
            var instanceRef = await testInstance;
            var service     = new InventoryService(
                new ComputeEngineAdapter(await credential));

            var info = await service.ListProjectInventoryAsync(
                TestProject.ProjectId,
                OperatingSystems.All,
                CancellationToken.None);

            Assert.IsTrue(info.ToList().Where(i => i.Instance == instanceRef).Any());
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Handle the caps inventory descendents fetch.
        ///
        /// Since the folder structure is sent to the client on login, I believe we only need to handle items.
        /// Diva comment 8/13/2009: what if someone gave us a folder in the meantime??
        /// </summary>
        /// <param name="agentID"></param>
        /// <param name="folderID"></param>
        /// <param name="ownerID"></param>
        /// <param name="fetchFolders"></param>
        /// <param name="fetchItems"></param>
        /// <param name="sortOrder"></param>
        /// <returns>null if the inventory look up failed</returns>
        public InventoryCollection HandleFetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID,
                                                                       bool fetchFolders, bool fetchItems, int sortOrder, out int version)
        {
            m_log.DebugFormat(
                "[INVENTORY CACHE]: Fetching folders ({0}), items ({1}) from {2} for agent {3}",
                fetchFolders, fetchItems, folderID, agentID);

            // FIXME MAYBE: We're not handling sortOrder!

            // TODO: This code for looking in the folder for the library should be folded back into the
            // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc.
            // can be handled transparently).
            InventoryFolderImpl fold;

            if (LibraryService != null && LibraryService.LibraryRootFolder != null)
            {
                if ((fold = LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
                {
                    version = 0;
                    InventoryCollection ret = new InventoryCollection();
                    ret.Folders = new List <InventoryFolderBase>();
                    ret.Items   = fold.RequestListOfItems();

                    return(ret);
                }
            }

            InventoryCollection contents = new InventoryCollection();

            if (folderID != UUID.Zero)
            {
                contents = InventoryService.GetFolderContent(agentID, folderID);
                InventoryFolderBase containingFolder = new InventoryFolderBase();
                containingFolder.ID    = folderID;
                containingFolder.Owner = agentID;
                containingFolder       = InventoryService.GetFolder(containingFolder);
                version = containingFolder.Version;
            }
            else
            {
                // Lost itemsm don't really need a version
                version = 1;
            }

            return(contents);
        }
        /// <summary>
        /// Run the code example.
        /// </summary>
        public void Run(DfpUser user)
        {
            using (InventoryService inventoryService =
                       (InventoryService)user.GetService(DfpService.v201708.InventoryService))
                using (NetworkService networkService =
                           (NetworkService)user.GetService(DfpService.v201708.NetworkService)) {
                    // Get the effective root ad unit ID of the network.
                    string effectiveRootAdUnitId = networkService.getCurrentNetwork().effectiveRootAdUnitId;

                    // Create a statement to select the children of the effective root ad
                    // unit.
                    StatementBuilder statementBuilder = new StatementBuilder()
                                                        .Where("parentId = :parentId")
                                                        .OrderBy("id ASC")
                                                        .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
                                                        .AddValue("parentId", effectiveRootAdUnitId);

                    // Set default for page.
                    AdUnitPage page = new AdUnitPage();

                    try {
                        do
                        {
                            // Get ad units by statement.
                            page = inventoryService.getAdUnitsByStatement(statementBuilder.ToStatement());

                            if (page.results != null)
                            {
                                int i = page.startIndex;
                                foreach (AdUnit adUnit in page.results)
                                {
                                    Console.WriteLine("{0}) Ad unit with ID = '{1}', name = '{2}' and " +
                                                      "status = '{3}' was found.", i, adUnit.id, adUnit.name, adUnit.status);
                                    i++;
                                }
                            }

                            statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
                        } while (statementBuilder.GetOffset() < page.totalResultSetSize);
                        Console.WriteLine("Number of results found: {0}", page.totalResultSetSize);
                    } catch (Exception e) {
                        Console.WriteLine("Failed to get ad unit. Exception says \"{0}\"", e.Message);
                    }
                }
        }
Ejemplo n.º 29
0
        public void Listen()
        {
            var config = new Dictionary <string, object>
            {
                { "group.id", "simple_consumer" },
                { "bootstrap.servers", "35.202.105.179:9092" },
                { "enable.auto.commit", "false" }
            };


            using (var consumer = new Consumer <Null, string>(config, null, new StringDeserializer(Encoding.UTF8)))
            {
                string       statusMessage;
                ArticleStock updatedStock;

                consumer.Subscribe(articlesTopic);
                Console.WriteLine("Consumer started...");

                consumer.OnMessage += (_, msg) =>
                {
                    DbContextOptions <InventoryContext> options = new DbContextOptionsBuilder <InventoryContext>()
                                                                  .UseNpgsql(connectionString)
                                                                  .Options;
                    InventoryContext context = new InventoryContext(options);

                    IInventoryService service = new InventoryService(context);

                    Console.WriteLine("JSON Array string ");
                    //messgae(msg.Value);
                    List <ArticleStock> articles = JsonConvert.DeserializeObject <List <ArticleStock> >(msg.Value);

                    Console.WriteLine("Iterating the list");
                    foreach (var item in articles)
                    {
                        Console.WriteLine($"Article id: {item.ArticleId}, Article Name: {item.ArticleName}, Quantity: {item.TotalQuantity}");
                        service.ReduceArticleStock(item.ArticleId, item, out updatedStock, out statusMessage);
                    }
                };

                while (true)
                {
                    consumer.Poll(100);
                }
            }
        }
Ejemplo n.º 30
0
        public Services(IConfigSource config, string configName, WebApp webApp)
        {
            m_log.Debug("[Wifi]: Services Starting...");

            m_WebApp = webApp;

            m_ServerAdminPassword = webApp.RemoteAdminPassword;
            //m_log.DebugFormat("[Services]: RemoteAdminPassword is {0}", m_ServerAdminPassword);
            m_LastStatisticsUpdate = new DateTime();

            // Create the necessary services
            m_UserAccountService    = new UserAccountService(config);
            m_AuthenticationService = new PasswordAuthenticationService(config);
            m_InventoryService      = new InventoryService(config);
            m_AssetService          = new AssetService(config);
            m_GridService           = new GridService(config);
            m_GridUserService       = new GridUserService(config);
            m_AvatarService         = new AvatarService(config);
            m_PresenceService       = new PresenceService(config);
            m_GroupsService         = new GroupsService(config);

            // Create the "God" account if it doesn't exist
            CreateGod();

            if (m_WebApp.BypassCertificateVerification)
            {
                ServicePointManager.ServerCertificateValidationCallback =
                    delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
                { return(true); }
            }
            ;

            // Connect to our outgoing mail server for password forgetfulness
            m_Client = new SmtpClient(m_WebApp.SmtpHost, m_WebApp.SmtpPort);
            if (m_WebApp.SmtpPort == 25)
            {
                m_Client.EnableSsl = false;
            }
            else
            {
                m_Client.EnableSsl = true;
            }
            m_Client.Credentials    = new NetworkCredential(m_WebApp.SmtpUsername, m_WebApp.SmtpPassword);
            m_Client.SendCompleted += new SendCompletedEventHandler(SendCompletedCallback);
        }
        public void Process_UpdateProduct_True()
        {
            InventoryService iService = new InventoryService();

            iService.CreateProduct(new Product {
                ProductID = 1, ProductName = "Fridge"
            });
            iService.CreateProduct(new Product {
                ProductID = 2, ProductName = "TV"
            });

            int    productId      = 2;
            string newProductName = "Television";

            iService.UpdateProduct(productId, newProductName);

            Assert.Equal(newProductName, iService.GetProduct(productId).ProductName);
        }
 public void Init() {
   TestUtils utils = new TestUtils();
   inventoryService = (InventoryService) user.GetService(DfpService.v201511.InventoryService);
   adUnit1 = utils.CreateAdUnit(user);
   adUnit2 = utils.CreateAdUnit(user);
 }
Ejemplo n.º 33
0
    void Start()
    {
        this.inventoryService = (InventoryService) this.gameObject.GetComponent("InventoryService");
        this.inventoryService.successResponseHandler = new WebService.SuccessResponseHandler(this.PopulateInventory);

        this.inventoryService.GetInventory("drpg_avatar", this.avatarId);
    }
 protected void SetInventoryService()
 {
     InventoryService = new InventoryService
     {
         APICredentialsValue = new APICredentials
         {
             DeveloperKey = AccountSettingsConfigSection.Ca_developerKey.Value,
             Password = AccountSettingsConfigSection.Ca_password.Value
         }
     };
 }