Example #1
0
        public void Update_IncorrectSubscriber_ShouldThrownSubscriberIncorrectException()
        {
            var dto = new SubscriberDto()
            {
                Id = DefaultData.Subscribers.Ivanov.Id
            };

            Assert.Throws <SubscriberIncorrectException>(async() => await SubscribersService.Update(dto.Id, dto));
        }
Example #2
0
        public void Update_ExistsSubscriber_ShouldThrownSubscriberDublicateException()
        {
            var dto = new SubscriberDto()
            {
                Id         = DefaultData.Subscribers.Ivanov.Id,
                Lastname   = DefaultData.Subscribers.Petrov.Lastname,
                Firstname  = DefaultData.Subscribers.Petrov.Firstname,
                Middlename = DefaultData.Subscribers.Petrov.Middlename
            };

            Assert.Throws <SubscriberDublicateException>(async() => await SubscribersService.Update(dto.Id, dto));
        }
Example #3
0
        public async Task Update_ShouldUpdated()
        {
            var dto = new SubscriberDto()
            {
                Id         = DefaultData.Subscribers.Sidorov.Id,
                Lastname   = "updateSubscriberTest_Lastname",
                Firstname  = "updateSubscriberTest_Firstname",
                Middlename = "updateSubscriberTest_Middlename"
            };
            var returnVal = await SubscribersService.Update(dto.Id, dto);

            #region Assert return value

            Assert.That(returnVal.Lastname, Is.EqualTo(dto.Lastname));
            Assert.That(returnVal.Firstname, Is.EqualTo(dto.Firstname));
            Assert.That(returnVal.Middlename, Is.EqualTo(dto.Middlename));

            #endregion

            var updatedSubscriber = Subscribers.Single(x => x.Id == dto.Id);
            Assert.That(updatedSubscriber.Lastname, Is.EqualTo(dto.Lastname));
            Assert.That(updatedSubscriber.Firstname, Is.EqualTo(dto.Firstname));
            Assert.That(updatedSubscriber.Middlename, Is.EqualTo(dto.Middlename));
        }
Example #4
0
        public void Update_IncorrectSubscriber_ShouldThrownSubscriberHasIncorrectIdException()
        {
            var dto = new SubscriberDto();

            Assert.Throws <SubscriberHasIncorrectIdException>(async() => await SubscribersService.Update(dto.Id, dto));
        }