public void Test_Supplier_CRUD() { var connector = new SupplierConnector(); #region CREATE var newSupplier = new Supplier() { Name = "TestSupplier", Address1 = "TestStreet 1", Address2 = "TestStreet 2", ZipCode = "01010", City = "Testopolis", CountryCode = "SE", //CountryCode needs to be valid Email = "*****@*****.**", Active = false, Bank = "TestBank", Currency = "SEK", Phone1 = "01011111345", }; var createdSupplier = connector.Create(newSupplier); MyAssert.HasNoError(connector); Assert.AreEqual(createdSupplier.Name, "TestSupplier"); #endregion CREATE #region UPDATE createdSupplier.Name = "UpdatedTestSupplier"; var updatedSupplier = connector.Update(createdSupplier); MyAssert.HasNoError(connector); Assert.AreEqual("UpdatedTestSupplier", updatedSupplier.Name); #endregion UPDATE #region READ / GET var retrievedSupplier = connector.Get(createdSupplier.SupplierNumber); MyAssert.HasNoError(connector); Assert.AreEqual("UpdatedTestSupplier", retrievedSupplier.Name); #endregion READ / GET #region DELETE connector.Delete(createdSupplier.SupplierNumber); MyAssert.HasNoError(connector); retrievedSupplier = connector.Get(createdSupplier.SupplierNumber); Assert.AreEqual(null, retrievedSupplier, "Entity still exists after Delete!"); #endregion DELETE }
public void Test_Supplier_CRUD() { #region Arrange //Add code to create required resources #endregion Arrange ISupplierConnector connector = new SupplierConnector(); #region CREATE var newSupplier = new Supplier() { Name = "TestSupplier", Address1 = "TestStreet 1", Address2 = "TestStreet 2", ZipCode = "01010", City = "Testopolis", CountryCode = "SE", //CountryCode needs to be valid Email = "*****@*****.**", Active = false, Bank = "TestBank", Currency = "SEK", Phone1 = "01011111345", BG = "1111111", PG = "1111111" }; var createdSupplier = connector.Create(newSupplier); Assert.AreEqual("TestSupplier", createdSupplier.Name); #endregion CREATE #region UPDATE createdSupplier.Name = "UpdatedSupplier"; var updatedSupplier = connector.Update(createdSupplier); Assert.AreEqual("UpdatedSupplier", updatedSupplier.Name); #endregion UPDATE #region READ / GET var retrievedSupplier = connector.Get(createdSupplier.SupplierNumber); Assert.AreEqual("UpdatedSupplier", retrievedSupplier.Name); #endregion READ / GET #region DELETE connector.Delete(createdSupplier.SupplierNumber); Assert.ThrowsException <FortnoxApiException>( () => connector.Get(createdSupplier.SupplierNumber), "Entity still exists after Delete!"); #endregion DELETE #region Delete arranged resources //Add code to delete temporary resources #endregion Delete arranged resources }