Exemple #1
0
        public async Task CreateContactReturnsBadRequestIfEmailAlreadyInUse()
        {
            var contactCreate = new ApplicationCore.Models.ContactCreate()
            {
                FirstName     = "Jack",
                LastName      = "White",
                Email         = _testContacts.First().Email, //duplicate email
                PhoneNumber   = "555-164-7158",
                ContactStatus = ContactStatusEnum.ActiveEnum
            };

            var createResult = await _sutContactService.CreateContact(contactCreate);

            Assert.True(createResult.IsBadRequest); //controller returns 400
        }
Exemple #2
0
        public async Task CreateContactReturnsContactIfValidIdPassed()
        {
            var contactCreate = new ApplicationCore.Models.ContactCreate()
            {
                FirstName     = "Jack",
                LastName      = "White",
                Email         = "*****@*****.**",
                PhoneNumber   = "555-164-7158",
                ContactStatus = ContactStatusEnum.ActiveEnum
            };

            var createResult = await _sutContactService.CreateContact(contactCreate);

            Assert.False(createResult.IsBadRequest); //controller won't return 400

            Assert.NotNull(createResult.Data);       //controller won't return 404

            Assert.Equal(contactCreate.Email, createResult.Data.Email);
        }