Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduced xUnit testing #923

Draft
wants to merge 13 commits into
base: develop
Choose a base branch
from
Draft

Introduced xUnit testing #923

wants to merge 13 commits into from

Conversation

jsenning
Copy link
Contributor

xUnit tests were added to the Gordon360 project using the following steps:

  1. Added xUnit tests

    • Open Gordon360 in Visual Studio
    • File -> Add -> New Project
    • Type “xUnit” in search bar and choose “xUnit Test project” with “c#” icon. Click Next.
    • Set project name to “UnitTestsGordon360”. Click Next.
    • Framework should be “.NET 6.0 (Long-term support). Click Create.
  2. Add reference to Gordon360 project

    • Expand “UnitTestsGordon360”
    • Right click on “Dependencies” and choose “Add Project Reference”
    • Click on checkbox next to Gordon360 to add this project. Click OK.
  3. Update framework to match Gordon360

    • Right click on “UnitTestsGordon360” and choose “Edit Project File”
    • Find <TargetFramework> tag and change value to be “net6.0-windows”.

Three sample tests (that don't have anything to do with the 360 code base) are included.

Ideas for good candidate functions to write tests for:

  • private bool CanReadOne() (found in Gordon360/Auothroization/StateYourBusiness.cs)
  • private bool CanReadAll() (also in StateYourBusiness)

@jsenning jsenning requested a review from ArabellaJi June 16, 2023 20:53
@andrew-wzj andrew-wzj self-assigned this Jun 21, 2023
@ArabellaJi
Copy link
Contributor

image

When I run the tests for ImageUtil, some tests passed and some failed. That's probably because I'm using the fake test image paths, so when we, for example, want to test if an image can be retrieved to a base64 data, it fails the test.

@EjPlatzer Is there any way we can test the file with some real images?

@EjPlatzer
Copy link
Contributor

image

When I run the tests for ImageUtil, some tests passed and some failed. That's probably because I'm using the fake test image paths, so when we, for example, want to test if an image can be retrieved to a base64 data, it fails the test.

@EjPlatzer Is there any way we can test the file with some real images?

My first thought is that we should simply put some images in the test project (i.e. literally add a jpg file into the folders of the test project), and use the path of that image for testing. You might also need a minimal base64 string of like a single pixel image to use for testing, but you can just make that a static string in the code.

@ArabellaJi ArabellaJi assigned andrew-wzj and unassigned andrew-wzj Jun 23, 2023
@andrew-wzj andrew-wzj mentioned this pull request Jun 30, 2023
@mla04762 mla04762 self-assigned this Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants