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

[RSN-59] - Created EventsController #59

Merged
merged 30 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a7d50e9
feat: add jwt and exceptions handlers
raczu Jun 1, 2024
077d9e2
test: add unit tests for jwt, handlers and validators
raczu Jun 1, 2024
c56618b
feat: add placeholders for endpoints
raczu Jun 2, 2024
7a7d3d4
chore: add missing controllers placeholders
raczu Jun 7, 2024
89362c8
Merge branch 'RSN-19' of https://github.com/wzarek/Reasn into RSN-19
bilimig Jun 20, 2024
9c616da
Created EventsController
bilimig Jun 13, 2024
cc22cc8
Little Updates
bilimig Jun 14, 2024
0832c4d
Updated controllers
bilimig Jun 16, 2024
32d432d
Update adding and updating image in eventController
bilimig Jun 17, 2024
79a1ff4
Updated eventcontroller logic
bilimig Jun 20, 2024
bded7ee
Updated EventsController
bilimig Jun 21, 2024
1554621
Fixed build issues
bilimig Jun 21, 2024
b2b51c0
updated eventscontroller
bilimig Jun 22, 2024
c170e48
fixed build issue
bilimig Jun 22, 2024
4566cc5
Update EventServicesTest.cs
bilimig Jun 22, 2024
64b9884
Update EventsController.cs
bilimig Jun 22, 2024
6174b9e
syntax update
bilimig Jun 22, 2024
b43bc83
updated models
bilimig Jun 22, 2024
722c787
Update EventServicesTest.cs
bilimig Jun 22, 2024
7807e0e
Updated EventController
bilimig Jun 22, 2024
51af7a5
updated events controller
bilimig Jun 23, 2024
f0458a3
updated logic in getallaevenst
bilimig Jun 23, 2024
9387f56
fixes and updates
bilimig Jun 23, 2024
3149088
Merge branch 'RSN-19' into RSN-59
bilimig Jun 23, 2024
0c464c8
Fixes and cleanup after rebase and confilts
bilimig Jun 23, 2024
b7dfb07
Update EventService.cs
bilimig Jun 23, 2024
4d3881d
updates
bilimig Jun 23, 2024
46c84db
Updated logic with slag on creation
bilimig Jun 23, 2024
5893f45
Update EventValidatorTests.cs
bilimig Jun 23, 2024
973c638
Update EventValidatorTests.cs
bilimig Jun 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions Server/ReasnAPI/ReasnAPI.Tests/Services/EventServicesTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public void UpdateEvent_EventExists_EventUpdated()
var eventDto = new EventDto()
{
Name = "name1",
AddressId = 1,
Description = "description2",
OrganizerId = 1,
StartAt = DateTime.Now,
Expand Down Expand Up @@ -82,7 +81,7 @@ public void UpdateEvent_EventExists_EventUpdated()
mockContext.Setup(c => c.Parameters).ReturnsDbSet(new List<Parameter>());
mockContext.Setup(c => c.Comments).ReturnsDbSet(new List<Comment>());
mockContext.Setup(c => c.Participants).ReturnsDbSet(new List<Participant>());
var eventService = new EventService(mockContext.Object, new ParameterService(mockContext.Object), new TagService(mockContext.Object), new CommentService(mockContext.Object));
var eventService = new EventService(mockContext.Object, new ParameterService(mockContext.Object), new TagService(mockContext.Object), new CommentService(mockContext.Object), new AddressService(mockContext.Object), new ImageService(mockContext.Object));

var result = eventService.UpdateEvent(1, eventDto);
Assert.AreEqual("name1", result.Name);
Expand All @@ -102,7 +101,6 @@ public void UpdateEvent_EventDoesNotExist_NullReturned()
var eventDto = new EventDto()
{
Name = "name1",
AddressId = 1,
Description = "description2",
OrganizerId = 1,
StartAt = DateTime.Now,
Expand Down Expand Up @@ -144,7 +142,7 @@ public void UpdateEvent_EventDoesNotExist_NullReturned()
UpdatedAt =DateTime.Now
}});

var eventService = new EventService(mockContext.Object, new ParameterService(mockContext.Object), new TagService(mockContext.Object), new CommentService(mockContext.Object));
var eventService = new EventService(mockContext.Object, new ParameterService(mockContext.Object), new TagService(mockContext.Object), new CommentService(mockContext.Object), new AddressService(mockContext.Object), new ImageService(mockContext.Object));

Assert.ThrowsException<NotFoundException>(() => eventService.UpdateEvent(1, eventDto));
}
Expand Down Expand Up @@ -205,7 +203,7 @@ public void GetEventById_EventExists_EventReturned()
UpdatedAt =DateTime.Now }});


var eventService = new EventService(mockContext.Object, new ParameterService(mockContext.Object), new TagService(mockContext.Object), new CommentService(mockContext.Object));
var eventService = new EventService(mockContext.Object, new ParameterService(mockContext.Object), new TagService(mockContext.Object), new CommentService(mockContext.Object), new AddressService(mockContext.Object), new ImageService(mockContext.Object));

var result = eventService.GetEventById(1);
Assert.IsNotNull(result);
Expand Down Expand Up @@ -250,7 +248,7 @@ public void GetEventById_EventDoesNotExist_NullReturned()
}});


var eventService = new EventService(mockContext.Object, new ParameterService(mockContext.Object), new TagService(mockContext.Object), new CommentService(mockContext.Object));
var eventService = new EventService(mockContext.Object, new ParameterService(mockContext.Object), new TagService(mockContext.Object), new CommentService(mockContext.Object), new AddressService(mockContext.Object), new ImageService(mockContext.Object));

Assert.ThrowsException<NotFoundException>(() => eventService.GetEventById(1));
}
Expand Down Expand Up @@ -320,7 +318,7 @@ public void DeleteEvent_EventExists_EventDeleted()
mockContext.Setup(c => c.Comments).ReturnsDbSet(new List<Comment>());
mockContext.Setup(c => c.Participants).ReturnsDbSet(new List<Participant>());

var eventService = new EventService(mockContext.Object, new ParameterService(mockContext.Object), new TagService(mockContext.Object), new CommentService(mockContext.Object));
var eventService = new EventService(mockContext.Object, new ParameterService(mockContext.Object), new TagService(mockContext.Object), new CommentService(mockContext.Object), new AddressService(mockContext.Object), new ImageService(mockContext.Object));

eventService.DeleteEvent(1);

Expand Down
Loading