コード例 #1
0
        public void AddDatepickerNoDatesUnprocessableException()
        {
            var testDatepicker = new TestDatepickerDto().DatepickerNoDates;
            var testUser       = new TestUser().User;

            Assert.ThrowsAsync <UnprocessableException>(() => _datepickerLogic.Add(testDatepicker, testUser));
        }
コード例 #2
0
        public void AddDuplicateNameException()
        {
            var testDatepicker = new TestDatepickerDto().DatepickerDuplicatedEventName;
            var testUser       = new TestUser().User;

            Assert.ThrowsAsync <DuplicateNameException>(() => _datepickerLogic.Add(testDatepicker, testUser));
        }
コード例 #3
0
        public void AddExpiredDatepickerUnprocessableException()
        {
            var testDatepicker = new TestDatepickerDto().DatepickerNotExisting;
            var testUser       = new TestUser().User;

            Assert.DoesNotThrowAsync(() => _datepickerLogic.Add(testDatepicker, testUser));
        }
コード例 #4
0
        public void UpdateDuplicatedNameExceptionTest()
        {
            var datepicker = new TestDatepickerDto().Datepicker;

            datepicker.Title = new TestDatepickerDto().Datepicker2.Title;
            Assert.ThrowsAsync <DuplicateNameException>(() => _datepickerLogic.Update(datepicker));
        }
コード例 #5
0
        public void DeleteUnauthorizedAccessExceptionTest()
        {
            var testDatepicker = new TestDatepickerDto().Datepicker;
            var testUser       = new TestUser().SiteAdmin;

            Assert.ThrowsAsync <UnauthorizedAccessException>(() => _datepickerLogic.Delete(testDatepicker.Uuid, testUser.Uuid));
        }
コード例 #6
0
        public async Task FindTest()
        {
            var           testDatepicker = new TestDatepickerDto().Datepicker;
            DatepickerDto result         = await _datepickerLogic.Find(testDatepicker.Uuid);

            Assert.NotNull(result);
        }
コード例 #7
0
        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;
        }
コード例 #8
0
        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));
        }
コード例 #9
0
        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;
        }
コード例 #10
0
        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;
        }
コード例 #11
0
        public void DeleteKeyNotFoundExceptionTest()
        {
            var testDatepicker = new TestDatepickerDto().DatepickerNotExisting;

            Assert.ThrowsAsync <KeyNotFoundException>(() => _datepickerLogic.Delete(testDatepicker.Uuid, Guid.Empty));
        }
コード例 #12
0
        public void DeleteTest()
        {
            var datepicker = new TestDatepickerDto().DatepickerNoUsers;

            Assert.DoesNotThrowAsync(() => _datepickerLogic.Delete(datepicker.Uuid, new TestUser().User.Uuid));
        }
コード例 #13
0
        public void FindKeyNotFoundExceptionTest()
        {
            var testDatepicker = new TestDatepickerDto().DatepickerNotExisting;

            Assert.ThrowsAsync <KeyNotFoundException>(() => _datepickerLogic.Find(testDatepicker.Uuid));
        }