예제 #1
0
        public void TestMethod_SignUpWithEmail_SuccessRegistration()
        {
            //Arrange
            var dbContext = InMemoryDatabaseFactory.Create();
            AccountRegistrationService registrationService = new AccountRegistrationService(dbContext);
            EmailLoginInfo             emailLoginInfo      = new EmailLoginInfo
            {
                Email    = "*****@*****.**",
                Password = "******"
            };
            string name = "Muhammad";

            //Act
            registrationService.RegisterAccountAsync(name, emailLoginInfo).Wait();

            //Assert
            var account = dbContext.Accounts
                          .Include(account1 => account1.EmailLoginInfo)
                          .Include(account1 => account1.OrderStatusGroups)
                          .First();

            Assert.AreEqual(name, account.Name);
            Assert.AreEqual(emailLoginInfo.Email, account.EmailLoginInfo.Email);
            Assert.AreEqual(emailLoginInfo.Password, account.EmailLoginInfo.Password);
            Assert.IsTrue(account.OrderStatusGroups.Count > 0);
        }
예제 #2
0
        public WhenRevisingMedia()
        {
            (_contextMock, _connection) = InMemoryDatabaseFactory.CreateSqliteDbContext();

            _timeProviderMock = new Mock <ITimeProvider>();
            _timeProviderMock.Setup(provider => provider.GetUtc())
            .Returns(_givenProvidedUtcDateTime);
        }
예제 #3
0
        public void TestMethod_SignUpWithNullTelegramInfo_RegistrationFailure()
        {
            //Arrange
            var dbContext = InMemoryDatabaseFactory.Create();
            AccountRegistrationService registrationService = new AccountRegistrationService(dbContext);
            string name = "Muhammad";

            //Act
            registrationService.RegisterAccountAsync(name, (TelegramLoginInfo)null).Wait();
        }
        public BotsAirstripServiceTest()
        {
            dbContext = InMemoryDatabaseFactory.Create();
            var logger                   = new StubLogger();
            var accessCheckService       = new AccessCheckService(dbContext);
            var monitorNegotiatorService = new MonitorNegotiatorService();
            var forestNegotiatorService  = new DichStubForestNegotiatorService(dbContext);

            botsAirstripService = new BotsAirstripService(logger, accessCheckService,
                                                          monitorNegotiatorService, forestNegotiatorService, dbContext);
        }
예제 #5
0
        public void TestMethod_SignUpWithNullName_RegistrationFailure()
        {
            //Arrange
            var dbContext = InMemoryDatabaseFactory.Create();
            AccountRegistrationService registrationService = new AccountRegistrationService(dbContext);
            TelegramLoginInfo          telegramLoginInfo   = new TelegramLoginInfo
            {
                TelegramId = Int32.MaxValue / 2
            };

            //Act
            registrationService.RegisterAccountAsync(null, telegramLoginInfo).Wait();
        }
        private void GivenSalesOrderControllerWithInMemoryDatabase()
        {
            // Follow this method into the factory to see how it sets up the in-memory database.

            InMemoryDatabaseFactory       factory = new InMemoryDatabaseFactory();
            DbContextOptions <TC3Context> options = new DbContextOptionsBuilder <TC3Context>().UseSqlite(factory.Instance.Connection).Options;

            dbContext = new TC3Context(options);
            dbContext.Database.EnsureCreated();

            salesOrdersService = new SalesOrdersService(dbContext);
            controller         = new SalesOrdersController(salesOrdersService);
        }
예제 #7
0
        public WhenUploadingFile()
        {
            var fileSystemMock      = new MockFileSystem();
            var fileStorageSettings = Options.Create(new FileStorageSettings()
            {
                RootDirectory = ""
            });

            _fileStorageMock            = new FileStorage(fileStorageSettings, fileSystemMock);
            (_contextMock, _connection) = InMemoryDatabaseFactory.CreateSqliteDbContext();

            _mediaIdProviderMock = new Mock <IMediaIdProvider>();
            _mediaIdProviderMock.SetupSequence(provider => provider.Generate())
            .Returns(_givenMediaInstanceId)
            .Returns(_givenAlternativeMediaInstanceId);

            _timeProviderMock = new Mock <ITimeProvider>();
            _timeProviderMock.Setup(provider => provider.GetUtc())
            .Returns(_givenProvidedUtcDateTime);
        }
예제 #8
0
        public void TestMethod_SignUpWithTelegram_SuccessRegistration()
        {
            //Arrange
            var dbContext = InMemoryDatabaseFactory.Create();
            AccountRegistrationService registrationService = new AccountRegistrationService(dbContext);
            TelegramLoginInfo          telegramLoginInfo   = new TelegramLoginInfo
            {
                TelegramId = Int32.MaxValue / 2
            };
            string name = "Muhammad";

            //Act
            registrationService.RegisterAccountAsync(name, telegramLoginInfo).Wait();

            //Assert
            var account = dbContext.Accounts
                          .Include(account1 => account1.TelegramLoginInfo)
                          .Include(account1 => account1.OrderStatusGroups)
                          .First();

            Assert.AreEqual(name, account.Name);
            Assert.AreEqual(telegramLoginInfo.TelegramId, account.TelegramLoginInfo.TelegramId);
            Assert.IsTrue(account.OrderStatusGroups.Count > 0);
        }
예제 #9
0
 public SplitInto2GraphsTest()
 {
     (_context, _connection) = InMemoryDatabaseFactory.CreateSqliteDbContext();
     _sut = new TagGraph(_context);
     ConstructGraph();
 }
예제 #10
0
 public TwoSymmetricalPathsTest()
 {
     (_context, _connection) = InMemoryDatabaseFactory.CreateSqliteDbContext();
     _sut = new TagGraph(_context);
     ConstructGraph();
 }
 public WhenMarkingMediaAsFavorite()
 {
     (_contextMock, _connection) = InMemoryDatabaseFactory.CreateSqliteDbContext();
 }
예제 #12
0
 public WhenGettingFavoriteMedia()
 {
     (_contextMock, _connection) = InMemoryDatabaseFactory.CreateSqliteDbContext();
 }
 public WhenRemovingMediaFromFavorites()
 {
     (_contextMock, _connection) = InMemoryDatabaseFactory.CreateSqliteDbContext();
 }
예제 #14
0
 public WhenGettingMediaRevisionHistory()
 {
     (_contextMock, _connection) = InMemoryDatabaseFactory.CreateSqliteDbContext();
 }
예제 #15
0
 public WhenCreatingCycle()
 {
     (_context, _connection) = InMemoryDatabaseFactory.CreateSqliteDbContext();
     _sut = new TagGraph(_context);
 }