public async Task TestGetByNumberInputMatches()
        {
            // Arrange
            var phoneNumbers = GeneratePhoneNumberEntityList();

            var mockDbSet = phoneNumbers.AsQueryable().BuildMockDbSet();

            var mockContext = new Mock <DemographicsDbContext>();

            mockContext
            .Setup(x => x.Set <PhoneNumber>())
            .Returns(mockDbSet.Object)
            .Verifiable();

            var testModel = new PhoneNumberInputModel
            {
                Number = "1234567890"
            };

            var repository = new PhoneNumberRepository(mockContext.Object);

            // Act
            var result = await repository.GetByNumber(testModel);

            // Assert
            Assert.NotNull(result);
            Assert.Equal("1234567890", result.Number);
        }
示例#2
0
        public QLSdt()
        {
            InitializeComponent();
            phoneNumberRepository = new PhoneNumberRepository();
            phoneNumberSource     = new BindingSource();

            bindSourceToDataGridView();
        }
示例#3
0
 public UnitOfWork(PersonKartotekContext context)
 {
     Context                  = context;
     AddressRepository        = new AddressRepository(context);
     PersonAddressRepository  = new PersonAddressRepository(context);
     PersonRepository         = new PersonRepository(context);
     PhoneNumberRepository    = new PhoneNumberRepository(context);
     PrimaryAddressRepository = new PrimaryAddressRepository(context);
     ZipRepository            = new ZipRepository(context);
 }
        public void TestGetByNumberModelNull()
        {
            // Arrange
            var repository = new PhoneNumberRepository(null);

            // Act
            async Task <PhoneNumber> TestAction() => await repository.GetByNumber(null);

            // Assert
            Assert.ThrowsAsync <ArgumentNullException>(TestAction);
        }
        public void TestCreateEntityNull()
        {
            // Arrange
            var repository = new PhoneNumberRepository(null);

            // Act
            PhoneNumber TestAction() => repository.Create(null);

            // Assert
            Assert.Throws <ArgumentNullException>(TestAction);
        }
示例#6
0
        public PhaxioClient(string key, string secret, IRestClient restClient)
            : base(key, secret, new RestClient())
        {
            // Initialize the rest client
            client         = restClient;
            client.BaseUrl = new Uri(phaxioApiEndpoint);

            Fax         = new FaxRepository(this);
            Public      = new PublicRepository(this);
            PhoneNumber = new PhoneNumberRepository(this);
            PhaxCode    = new PhaxCodeRepository(this);
            Account     = new AccountRespository(this);
        }
示例#7
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context       = context;
     City           = new CityRepository(_context);
     Product        = new ProductRepository(_context);
     Address        = new AddressRepository(_context);
     Comment        = new CommentRepository(_context);
     Country        = new CountryRepository(_context);
     Email          = new EmailRepository(_context);
     PhoneNumber    = new PhoneNumberRepository(_context);
     ProductPicture = new ProductPictureRepository(_context);
     ProductType    = new ProductTypeRepository(_context);
     State          = new StateRepository(_context);
 }
        public void TestGetNumberModelNumberEmpty()
        {
            // Arrange
            var repository = new PhoneNumberRepository(null);

            var testObject = new PhoneNumberInputModel
            {
                Number = ""
            };

            // Act
            async Task <PhoneNumber> TestAction() => await repository.GetByNumber(testObject);

            // Assert
            Assert.ThrowsAsync <ArgumentNullException>(TestAction);
        }
        public void TestCreateEntityNumberEmpty()
        {
            // Arrange
            var repository = new PhoneNumberRepository(null);

            var testObject = new PhoneNumber
            {
                Number = ""
            };

            // Act
            PhoneNumber TestAction() => repository.Create(testObject);

            // Assert
            Assert.Throws <ArgumentNullException>(TestAction);
        }
        public void TestCreateEntityValid()
        {
            // Arrange
            var mockContext = new Mock <DemographicsDbContext>();

            mockContext
            .Setup(x => x.Set <PhoneNumber>().Add(It.IsAny <PhoneNumber>()))
            .Verifiable();

            var repository = new PhoneNumberRepository(mockContext.Object);

            var testObject = new PhoneNumber
            {
                Number = "1234567890"
            };
            // Act
            var result = repository.Create(testObject);

            // Assert
            Assert.NotNull(result);

            mockContext
            .Verify(x => x.Set <PhoneNumber>().Add(It.IsAny <PhoneNumber>()), Times.Once);
        }
示例#11
0
 public void Setup()
 {
     _ctx.Database.Delete();
     _repository = new PhoneNumberRepository(_ctx);
 }
示例#12
0
 public SIMRegistrationProcedure()
 {
     customerRepository    = new CustomerRepository();
     phoneNumberRepository = new PhoneNumberRepository();
     simRepository         = new SIMRepository();
 }