Beispiel #1
0
        public void Create_ExistsSubscriber_ShouldThrownSubscriberDublicateException()
        {
            var dto = new SubscriberDto()
            {
                Lastname   = DefaultData.Subscribers.Petrov.Lastname,
                Firstname  = DefaultData.Subscribers.Petrov.Firstname,
                Middlename = DefaultData.Subscribers.Petrov.Middlename
            };

            Assert.Throws <SubscriberDublicateException>(async() => await SubscribersService.Create(dto));
        }
Beispiel #2
0
        public async Task Create_ShouldCreated()
        {
            var oldCount   = Subscribers.Count;
            var subscriber = new SubscriberDto()
            {
                Id         = Random.Next(int.MaxValue),
                Lastname   = "Novoselov",
                Firstname  = "Oleg",
                Middlename = "Middlename'ovich"
            };
            await SubscribersService.Create(subscriber);

            Assert.That(Subscribers.Count, Is.EqualTo(oldCount + 1));
            var created = Subscribers.Single(x => x.Id == subscriber.Id);

            Assert.That(created.Lastname, Is.EqualTo(subscriber.Lastname));
            Assert.That(created.Firstname, Is.EqualTo(subscriber.Firstname));
            Assert.That(created.Middlename, Is.EqualTo(subscriber.Middlename));
        }
Beispiel #3
0
        public void Create_IncorrectSubscriber_ShouldThrownSubscriberIncorrectException()
        {
            var dto = new SubscriberDto();

            Assert.Throws <SubscriberIncorrectException>(async() => await SubscribersService.Create(dto));
        }