Altering Tests based on Database Changes & Testing New Interface

I added new entity into existing database migration, and update stored value in database. Due to new entity is added, most unit tests and integration tests failed. When put those tests to debug, It appears that there is database type of exception. Hence, I need refactor existing Test Base by adding value for new entities in order for tests to assert properly.

After that, I get to play around with new interface and get familiar with it implementation. The implementation are the use of Regex, Unit of Measurement for calculation in system. Also, implementation of combo box, search bar, CRUD and data injection from few other MVVM services for functionality in system.

Multithreading on Pick module

For this week, I’ve continue to develop on the new task which is the pick module. After the UI creation is completed, I’ve inserted some dummy data to test the UI. However, in order to make sure the user always get the latest sales order data from the database for pick module, multithreading is applied to the module.

Multithreading is used in the pick module which aim to refresh the sales order data and update the UI data grid view at the background. Not only that, it also require retrieve the latest row version in order to avoid concurrency error.

However, I’ve faced problem which update data grid binding source in the thread does not reflect in the UI data grid view even thought I’ve define a new collection for the binding source. After I’ve search for solution on the Internet, I’ve learned that I should call dispatcher for UI updating work and for the binding source, I’m only allowed to perform .Clear(), .Add(), AddRange(), and Remove() instead of defining new collection.

Brainstorming on new task

For the previous week, I had completed with the User module and merged with the master project. I’ve been assigned with new task which is develop the sales order picking module. I’ve been briefed on the module such as its functionalities, requirements, input data and output data that the module should produce.

After that, I’ve started to brainstorming toward the module. I’ve figured and listed down the business flow of the sales order picking module. First of all, user will need to select the sales order that they wish to pick. On the same time, the selected sales order details / attribute will also be shown in the same view. The line items that contained in the selected sales order. Therefore, user will able to proceed with their picking process by entering the amount to pick.

Lastly, I’ve designed the UI of the module and amend it based on the requirements and make it to be more user friendly. I’ve also started to design the Pick service which will contains all the service needed and will be used in the view model in the future.

Utilizing EF Core Exception Handling & Debugging CRUD methods

I continued my progress with fixing delete function, which suppose to remove linked data in multiple table across the database. The failure of delete function due to certain entity are set as foreign key of other table. This problem is solved by setting null value for related foreign key in delete function. As the value of foreign key is null, deletion is allowed as how it suppose to behave.

Next, I alter sequence of textbox in View class. To ensure best user experience when they uses hotkey “Tab” to navigates over to next textbox available.

Then, Remove validation made in ViewModel class and implement it in repository class. Allowing EF core throw error whenever unique entity is input multiple time. The error will be catch, hence, prompt dialog box to notify user of application. This way is a better implementation reduce number of code, however it cause few issue in application. Issue such as user unable to create new user after error popped up to indicate similar user id appears in database.

In conjunction, RepositoryActualDbTests class is created to mock my situation. I arrange declaration, execute three seperate input ( 1st input : id = 1, 2nd input : id = 1, 3rd input : id = 2 ) , and assert expected behaviour ( Total of 2 input should be saved input database ). After quite an amount of testing and struggling, the bug is then fixed, however it requires chain fix in code. Therefore, my supervisor advice me to try out a different implementation for my create function by mocking a test.

Validating and Granting Access Rights

For new context and module added last week, I imitate some tests from example code provided and add few new tests. I also create some class to build dummy database to ease unit/integration testing. After going through some tests, I found out error when deleting data. Upon deletion, only data from 1 table is deleted, delete function suppose to remove few linked data across the database.

Before I look through into bugs of deletion, I make new implementation to validate user input in required textbox. If textbox is empty for non-nullable textbox, I create validation for system to prompt warning dialog to notify user. such as below :
if (string.IsNullOrEmpty(Wrapper.Variable))
{
_dialogService.ShowDialog( n, p, r );
return false;
}


Besides, Admin role is added to alter availability of buttons in system. I was been told to make initialization of adminUser as variable. Variable adminUser is set to bool = false initially, and will be implement in feature implementation. If bool adminUser = true, user is an admin user; bool adminUser = false, user is normal user. The reason of adding in admin role is to restrict some functionality of normal user. For normal user, the system will hinder user from edit or delete data in the system. In significant, admin user will be granted privilege to edit and delete.

Implementation of FlaUI and Wrapper Class

For this week, I’ve started with the unit testing for the Hash Generator application. However, due to the Hash Generator is a Windows Form application , I’ve faced the problem when conducting the unit testing. It will pop out the message box while the test is running while I will need to close the dialog manually while running the unit tests.

In order to solve this problem, I had implemented the FlaUI which is a .net library which helps with automated UI testing of Windows applications. Not only that, I’ve also learned to implement the Thread.Sleep() and Retry.WhileException() which is used to retry the automation process if it fails to find descendants.

After that, I had implement the User and Privilege Wrapper class for the entire User Module in order to place the logged in user in the wrapper class for other module to verify the user’s privilege and authorize with relevance rights.

Implementation of New Context and Module

As I commits previous task, I now proceed to the next task and given duration of 3 weeks. I am required to create certain function of the application, which records details of customer. Thus, I begin my progress by developing UI View in XAML class based on given example. It is to ensure standardized UI across the application.

Next, based on given example, I implement Configuration, Repository class and perform Migration to database in context file; ViewModel, Event, and Parameter class in module file. Besides, I also perform tests for customerRepository and customerViewModel to makesure they work as expected.

There are some mistake that I did during these implementation, which caused failure of saving customer data into database. After going through some repository test, everything ran successful. Then, I found out that I failed to bind my View and ViewModel. After refactoring the codes, I manage to solve my problem.

Modifications on User Module

For this week, I’ve been assigned with new tasks that required to move the user creation features from user module to hash generator project and implement new features such as user edit, delete and editable custom salt in hash generator project.

Firstly, I’ve create the UI for the hash generator. I’ve also created a new model class and database table that used to store the editable custom salt. For the hash generator, it allows user to add and update a custom salt that will be used together with the hash generation. By updating the custom salt, it will reset all user password to default password.

After the hash generator project had finish implemented those features, I’ve started to remove the existing features from the user module. I’ve also create unit tests for the hash generator project.