Example #1
0
        public void FindAllUsersForApplication_StateUnderTest_ExpectedBehavior()
        {
            // Arrange
            var accessorFactory      = new AccessorFactory();
            var applicationsAccessor = accessorFactory.CreateAccessor <IApplicationsAccessor>();
            var DatabaseMock         = new DatabaseMock();

            DatabaseMock.SeedDatabase();
            string applicationName = DatabaseMock.GetValue("applicationName");

            // Act
            var result = applicationsAccessor.FindAllUsersForApplication(applicationName);

            // Assert
            Assert.NotEmpty(result);
        }
        public void GetApplicationUsers_StateUnderTest_ExpectedBehavior()
        {
            // Arrange
            var managerFactory = new ManagerFactory();
            var manager        = managerFactory.CreateManager <IApplicationManager>();
            var DatabaseMock   = new DatabaseMock();

            DatabaseMock.SeedDatabase();
            string applicationName = DatabaseMock.GetValue("applicationName");

            // Act
            var result = manager.GetApplicationUsers(applicationName);

            // Assert
            Assert.NotEmpty(result);
        }
        public void RemoveApplication_StateUnderTest_ExpectedBehavior()
        {
            // Arrange
            var managerFactory = new ManagerFactory();
            var manager        = managerFactory.CreateManager <IApplicationManager>();
            var DatabaseMock   = new DatabaseMock();

            DatabaseMock.SeedDatabase();
            var    applicationId   = DatabaseMock.GetId("applicationId");
            string applicationName = DatabaseMock.GetValue("applicationName");

            // Act
            manager.RemoveApplication(applicationId);

            // Assert
            Assert.Null(manager.GetApplicationUsers(applicationName));
        }
Example #4
0
        public void AddApplication_StateUnderTest_ExpectedBehavior()
        {
            // Arrange
            ActorSystem actorSystem            = ActorSystem.Create("TestActorSystem");
            Props       actorRouter            = Props.Create <ApplicationsActor>().WithRouter(new RoundRobinPool(5));
            IActorRef   actorPool              = actorSystem.ActorOf(actorRouter, "Test");
            var         applicationsController = new ApplicationsController(actorPool);
            var         DatabaseMock           = new DatabaseMock();

            DatabaseMock.SeedDatabase();
            string applicationName = DatabaseMock.GetValue("applicationName");

            // Act
            var result = applicationsController.AddApplication(applicationName).Result;

            // Assert
            Assert.NotNull(result.Value);
        }