public void AddDatepickerNoDatesUnprocessableException() { var testDatepicker = new TestDatepickerDto().DatepickerNoDates; var testUser = new TestUser().User; Assert.ThrowsAsync <UnprocessableException>(() => _datepickerLogic.Add(testDatepicker, testUser)); }
public void AddDuplicateNameException() { var testDatepicker = new TestDatepickerDto().DatepickerDuplicatedEventName; var testUser = new TestUser().User; Assert.ThrowsAsync <DuplicateNameException>(() => _datepickerLogic.Add(testDatepicker, testUser)); }
public void AddExpiredDatepickerUnprocessableException() { var testDatepicker = new TestDatepickerDto().DatepickerNotExisting; var testUser = new TestUser().User; Assert.DoesNotThrowAsync(() => _datepickerLogic.Add(testDatepicker, testUser)); }
public void UpdateDuplicatedNameExceptionTest() { var datepicker = new TestDatepickerDto().Datepicker; datepicker.Title = new TestDatepickerDto().Datepicker2.Title; Assert.ThrowsAsync <DuplicateNameException>(() => _datepickerLogic.Update(datepicker)); }
public void DeleteUnauthorizedAccessExceptionTest() { var testDatepicker = new TestDatepickerDto().Datepicker; var testUser = new TestUser().SiteAdmin; Assert.ThrowsAsync <UnauthorizedAccessException>(() => _datepickerLogic.Delete(testDatepicker.Uuid, testUser.Uuid)); }
public async Task FindTest() { var testDatepicker = new TestDatepickerDto().Datepicker; DatepickerDto result = await _datepickerLogic.Find(testDatepicker.Uuid); Assert.NotNull(result); }
public MockedDatepickerDateDal() { var testDatepicker = new TestDatepickerDto().Datepicker; var datepickerDalDateMock = new Mock <IDatepickerDateDal>(); datepickerDalDateMock.Setup(dpd => dpd.Find(testDatepicker.Uuid)).ReturnsAsync(testDatepicker.Dates); DatepickerDateDal = datepickerDalDateMock.Object; }
public void AddOrUpdateAsyncTest() { var testUser = new TestUser().User; var testDatepicker = new TestDatepickerDto().Datepicker; var availableDates = testDatepicker.Dates .Select(d => d.Uuid) .ToList(); Assert.DoesNotThrowAsync(() => _datepickerAvailabilityLogicTest.AddOrUpdateAsync(availableDates, testDatepicker.Uuid, testUser)); }
public MockedDatepickerDal() { var testDatepicker = new TestDatepickerDto(); var datepickerDalMock = new Mock <IDatepickerDal>(); datepickerDalMock.Setup(dpd => dpd.Find(testDatepicker.Datepicker.Uuid)).ReturnsAsync(testDatepicker.Datepicker); datepickerDalMock.Setup(dpd => dpd.Exists(testDatepicker.Datepicker.Title)).ReturnsAsync(true); datepickerDalMock.Setup(dpd => dpd.Exists(testDatepicker.Datepicker2.Title)).ReturnsAsync(true); datepickerDalMock.Setup(dpd => dpd.Exists(testDatepicker.DatepickerDuplicatedEventName.Title)).ReturnsAsync(true); datepickerDalMock.Setup(dpd => dpd.Find(testDatepicker.DatepickerDuplicatedEventName.Uuid)) .ReturnsAsync(testDatepicker.DatepickerDuplicatedEventName); datepickerDalMock.Setup(dpd => dpd.Find(testDatepicker.Datepicker2.Uuid)) .ReturnsAsync(testDatepicker.Datepicker2); DatepickerDal = datepickerDalMock.Object; }
public MockedDatepickerLogic() { var mockedDatepickerDal = new MockedDatepickerDal().DatepickerDal; var mockedDatepickerDateDal = new MockedDatepickerDateDal().DatepickerDateDal; var mockedPublisher = new Mock <IPublisher>(); var mockedRpcClient = new Mock <IRpcClient>(); var testDatepicker = new TestDatepickerDto(); mockedRpcClient.Setup(rpc => rpc.Call <bool>(testDatepicker.DatepickerDuplicatedEventName.Title, RabbitMqQueues.ExistsEventQueue)).Returns(true); var mockedChannel = new Mock <IModel>().Object; var autoMapperConfig = AutoMapperConfig.Config.CreateMapper(); var datepickerLogic = new DatepickerLogic(mockedDatepickerDal, mockedChannel, mockedPublisher.Object, mockedRpcClient.Object, autoMapperConfig, mockedDatepickerDateDal); DatepickerLogic = datepickerLogic; }
public void DeleteKeyNotFoundExceptionTest() { var testDatepicker = new TestDatepickerDto().DatepickerNotExisting; Assert.ThrowsAsync <KeyNotFoundException>(() => _datepickerLogic.Delete(testDatepicker.Uuid, Guid.Empty)); }
public void DeleteTest() { var datepicker = new TestDatepickerDto().DatepickerNoUsers; Assert.DoesNotThrowAsync(() => _datepickerLogic.Delete(datepicker.Uuid, new TestUser().User.Uuid)); }
public void FindKeyNotFoundExceptionTest() { var testDatepicker = new TestDatepickerDto().DatepickerNotExisting; Assert.ThrowsAsync <KeyNotFoundException>(() => _datepickerLogic.Find(testDatepicker.Uuid)); }