Професионална програма
Loading...
+ Нов въпрос
PetroslavGochev avatar PetroslavGochev 13 Точки

CSharp-OOP-UnitTest-Exercise-2.DataBaseExtending

Здравейте, имам проблем със следната задача от UnitTest - Exercise:

Problem 2.Extended Database

You already have a class - Database. We have modified it and added some more functionality to it. It supports adding, removing and finding People. In other words, it stores People. There are two types of finding methods - first: FindById (long id) and the second one: FindByUsername (string username). As you may guess, each person has its own unique id, and unique username. Your task is to test the provided project.

Constraints

Database should have methods:

  • Add
    • If there are already users with this username, InvalidOperationException is thrown.
    • If there are already users with this id, InvalidOperationException is thrown.
  • Remove
    • FindByUsername
    • If no user is present by this username, InvalidOperationException is thrown.
    • If username parameter is null, ArgumentNullException is thrown.
    • Arguments are all CaseSensitive.
  • FindById
    • If no user is present by this id, InvalidOperationException is thrown.
    • If negative ids are found, ArgumentOutOfRangeException is thrown.

Hint

Do not forget to test the constructor(s). They are methods too! Also keep in mind that all the functionality from the previous task still exists and you need to test it again!

В Джъдж ми дава 92/100 като ми гърми 4 ти тест с Грешен Отговор прилагам и код към кода ми :) https://pastebin.com/7c1ztUTY

Тагове:
0
C# OOP Advanced 16/01/2021 13:48:05
PetarNeshkov5360 avatar PetarNeshkov5360 23 Точки

Здравей! Изпращам примерно решение!

https://easyupload.io/htk7a9

0