Skip to content

Commit

Permalink
fix workshop tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DmyMi committed Sep 6, 2021
1 parent 7d20366 commit d39e05f
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
using Moq;
using NUnit.Framework;
using OutOfSchool.WebApi.Config;
using OutOfSchool.WebApi.Controllers.V1;
using OutOfSchool.WebApi.Extensions;
using OutOfSchool.WebApi.Models;
Expand All @@ -28,6 +30,7 @@ public class WorkshopControllerTests
private static List<WorkshopCard> workshopCards;
private static WorkshopDTO workshop;
private static ProviderDto provider;
private static Mock<IOptions<AppDefaultsConfig>> options;

private WorkshopController controller;
private Mock<IWorkshopServicesCombiner> workshopServiceMoq;
Expand All @@ -51,6 +54,11 @@ public void OneTimeSetup()
workshop = FakeWorkshop();
provider = FakeProvider();
workshopCards = FakeWorkshopCards();

var config = new AppDefaultsConfig();
config.City = "Київ";
options = new Mock<IOptions<AppDefaultsConfig>>();
options.Setup(x => x.Value).Returns(config);
}

[SetUp]
Expand All @@ -60,7 +68,7 @@ public void Setup()
providerServiceMoq = new Mock<IProviderService>();
localizer = new Mock<IStringLocalizer<SharedResource>>();

controller = new WorkshopController(workshopServiceMoq.Object, providerServiceMoq.Object, localizer.Object)
controller = new WorkshopController(workshopServiceMoq.Object, providerServiceMoq.Object, localizer.Object, options.Object)
{
ControllerContext = new ControllerContext() { HttpContext = httpContextMoq.Object },
};
Expand Down

0 comments on commit d39e05f

Please sign in to comment.