Refactoring code based on Integration Tests

There is few thing had been done, as shown as below that involve Test-Driven Development (TDD):

As some of my repository integration tests failed, I then refactor/alter my existing implementation of updating database from ReadData to GetData. ReadData in repository class has AsNoTracking(), where entity will not be tracked. When we make changes on the entity and will not be updated anyhow after calling context.SaveChanges(). By changing to GetData which allow entity to be tracked and any changes will be updated upon context.SaveChanges(). It also make sure latest data been retrieve after they are changed.

There is many repository test been done such as should add new, should update, should remove, should throw error, should roll back. I make sure these context integration tests passes and proceed to ViewModel classes tests. Following tests is mainly to make sure my implementation works fine under multiple scenario.

Most existing ViewModel integration tests failed as refactor of initialization is needed. ViewModel tests passed after few initialization, however there is few test involving DialogServiceMock failed to launch action of dialog in ViewModel class upon debugging. Despite that, the particular scenario works well when I run the application. Therefore, I need to figure out the factor behind failure of my test.

Leave a Reply