示例#1
0
        public async Task WhenAddingContactInfoToNonExistingCustomer_ShouldReturnNotFound()
        {
            var contactInfoItem = ApiDtoGenerator.ContactInfoItemGenerator();
            var apiResult       = await _sut.Put(_notExistingId, contactInfoItem);

            Assert.IsType <NotFoundResult>(apiResult.Result);
        }
示例#2
0
        public async Task WhenAddingValidContactDataToACustomer_ItShouldReturnOIk()
        {
            var contactInfoItem = ApiDtoGenerator.ContactInfoItemGenerator();

            var apiResult = await _sut.Put(_existingId, contactInfoItem);

            Assert.IsType <OkResult>(apiResult.Result);
        }
示例#3
0
        public async Task WhenAddingDuplicateContactDataToACustomer_ItShouldReturnBadRequest()
        {
            var contactInfoItem1 = ApiDtoGenerator.ContactInfoItemGenerator().Generate();

            var apiResult1 = await _sut.Put(_existingId, contactInfoItem1);

            Assert.IsType <OkResult>(apiResult1.Result);
            var apiResult2 = await _sut.Put(_existingId, contactInfoItem1);

            Assert.IsType <BadRequestObjectResult>(apiResult2.Result);
        }
示例#4
0
        public void WhenMap_Dto_To_Entity_ShouldAllPropertiesMapped()
        {
            var faker = ApiDtoGenerator.ContactInfoItemGenerator();

            var item = faker.Generate();


            var entity = _sut.Map(item);

            using (new AssertionScope())
            {
                item.Type.Should().Be(entity.Type);
                item.Value.Should().Be(entity.Value);
            }
        }