Пример #1
0
        public async Task CreateCompanyAsyncTest_WhitCorrectData_ShouldReturnTrue()
        {
            var context = SteuDbContextInMemoryFactory.InitializeContext();

            MapperInitializer.InitializeMapper();
            var repository = new EfDeletableEntityRepository <Company>(context);

            var service = new CompaniesService(repository);

            var model = new CreateCompanyBindingModel()
            {
                Name       = "Test Ltd",
                UIC        = "123123123",
                UserId     = "asdasd asd asd asd ",
                LicenseUrl = "dadadasdadasd",
            };

            var user = new SteuUser()
            {
                Id = "asdadas",
            };

            var actualResult = await service.CreateCompanyAsync(model, user);

            Assert.True(actualResult);
        }
Пример #2
0
        public async Task CreateCompanyAsyncTest_WhitNullUser_ShouldReturnArgumentNullException()
        {
            var context = SteuDbContextInMemoryFactory.InitializeContext();

            MapperInitializer.InitializeMapper();
            var repository = new EfDeletableEntityRepository <Company>(context);

            var service = new CompaniesService(repository);

            var model = new CreateCompanyBindingModel()
            {
                Name       = "Test Ltd",
                UIC        = "123123123",
                UserId     = "asdasd asd asd asd ",
                LicenseUrl = "dadadasdadasd",
            };

            await Assert.ThrowsAsync <ArgumentNullException>(() => service.CreateCompanyAsync(model, null));
        }