public async Task CreateAsync_GivenAlreadyUsedName_ThrowsItemNotProcessableException()
        {
            // Arrange
            var ldapAuthenticationModeRepository = Substitute.For <ILdapAuthenticationModeRepository>();
            var ldapConnectionService            = Substitute.For <ILdapConnectionService>();

            ldapAuthenticationModeRepository.CreateAsync(Arg.Any <LdapAuthenticationModeModel>()).Returns(mockedAuthenticationMode);
            ldapAuthenticationModeRepository.GetByNameAsync(mockedAuthenticationModeSubmit.Name).Returns(mockedAuthenticationMode);

            var authenticationModeService = new LdapAuthenticationModeService(ldapAuthenticationModeRepository, mapper, ldapConnectionService);

            // Act
            Exception caughtEx = null;

            try
            {
                var authenticationModeResource = await authenticationModeService.CreateAsync(mockedAuthenticationModeSubmit, Guid.NewGuid());
            }
            catch (Exception ex)
            {
                caughtEx = ex;
            }

            // Assert
            Assert.True(caughtEx is ItemNotProcessableException, "Attempted create with an already used name must throw an ItemNotProcessableException.");
        }
        public async Task CreateAsync_GivenFullProcessableModel_ReturnsCreatedModel()
        {
            // Arrange
            var ldapAuthenticationModeRepository = Substitute.For <ILdapAuthenticationModeRepository>();
            var ldapConnectionService            = Substitute.For <ILdapConnectionService>();

            ldapAuthenticationModeRepository.CreateAsync(Arg.Any <LdapAuthenticationModeModel>()).Returns(mockedAuthenticationMode);

            var ldapAuthenticationModeService = new LdapAuthenticationModeService(ldapAuthenticationModeRepository, mapper, ldapConnectionService);

            // Act
            var ldapAuthenticationModeResource = await ldapAuthenticationModeService.CreateAsync(mockedAuthenticationModeSubmit, Guid.NewGuid());

            // Assert
            Assert.NotNull(ldapAuthenticationModeResource);
            Assert.True(ldapAuthenticationModeResource.Name == mockedAuthenticationModeSubmit.Name, $"Resource Name: '{ldapAuthenticationModeResource.Name}' not the expected value: '{mockedAuthenticationModeSubmit.Name}'");
            Assert.True(ldapAuthenticationModeResource.Account == mockedAuthenticationModeSubmit.Account, $"Resource Account: '{ldapAuthenticationModeResource.Account}' not the expected value: '{mockedAuthenticationModeSubmit.Account}'");
            Assert.True(ldapAuthenticationModeResource.BaseDn == mockedAuthenticationModeSubmit.BaseDn, $"Resource BaseDn: '{ldapAuthenticationModeResource.BaseDn}' not the expected value: '{mockedAuthenticationModeSubmit.BaseDn}'");
            Assert.True(ldapAuthenticationModeResource.HostName == mockedAuthenticationModeSubmit.HostName, $"Resource HostName: '{ldapAuthenticationModeResource.HostName}' not the expected value: '{mockedAuthenticationModeSubmit.HostName}'");
            Assert.True(ldapAuthenticationModeResource.IsLdaps == mockedAuthenticationModeSubmit.IsLdaps, $"Resource IsLdaps: '{ldapAuthenticationModeResource.IsLdaps}' not the expected value: '{mockedAuthenticationModeSubmit.IsLdaps}'");
            Assert.True(ldapAuthenticationModeResource.Port == mockedAuthenticationModeSubmit.Port, $"Resource Port: '{ldapAuthenticationModeResource.Port}' not the expected value: '{mockedAuthenticationModeSubmit.Port}'");
        }