Skip to content

Homework#4

Open
cosminboc wants to merge 3 commits intobalcanusebi:masterfrom
cosminboc:master
Open

Homework#4
cosminboc wants to merge 3 commits intobalcanusebi:masterfrom
cosminboc:master

Conversation

@cosminboc
Copy link

Add test
Delete test

Add test
Delete test
Copy link
Owner

@balcanusebi balcanusebi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do the required changes and push again

[Test]
public void AddCoffeWithoutPrice_DoesNotAddCoffee()
{
var CoffeeLenghtList = coffeeService.GetCoffees().Count;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naming, please use camelCase, not PascalCase


var ex = Assert.Throws<Exception>(() => coffeeService.AddCoffee(AddCoffeeDetails));
Assert.AreEqual(ex.Message, "Already exists an entry with the same Id");

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove white spaces

var AddCoffeeDetails = coffeeService.GetCoffees()[0];

var ex = Assert.Throws<Exception>(() => coffeeService.AddCoffee(AddCoffeeDetails));
Assert.AreEqual(ex.Message, "Already exists an entry with the same Id");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a space between action and assertion


if(coffeeId == Guid.Empty) throw new Exception("The Id given is empty");
if (coffeeModels.Any(j => j.Id == coffeeId))
coffeeModels.Remove(coffeeModels.First(i => i.Id == coffeeId));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add indentation for the success if branch, it's confusing to have them one right after another

coffeeModels.Add(coffeeToAdd);

if (coffeeModels.Any(i => i == coffeeToAdd)) throw new Exception("Already exists an entry with the same Id");
if (!(coffeeToAdd.Id == Guid.Empty || coffeeToAdd.Name == null || coffeeToAdd.Price <= 0.0f || coffeeModels.Any(j => j.Name == coffeeToAdd.Name) || coffeeModels.Any(j => j.Id == coffeeToAdd.Id) || coffeeModels.Any(j => j.Price == coffeeToAdd.Price)))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please make a method that does all of these checks. No line of code should be that big in order to scroll to see.

Copy link
Owner

@balcanusebi balcanusebi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do the changes and push them again

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.

2 participants