Пример #1
0
 /// <summary>
 /// Creates a Blab Service?
 /// </summary>
 /// <param name="adapter">BlabAdapter object</param>
 /// <returns></returns>
 public BlabService CreateBlabService(BlabAdapter adapter = null)
 {
     if (adapter == null)
     {
         adapter = CreateBlabAdapter();
     }
     return(new BlabService(adapter));
 }
        public void BuildAdapterTest()
        {
            //Arrange and Act
            BlabAdapter blabAdapter = harness.CreateBlabAdapter();

            //Assert
            Assert.IsTrue(blabAdapter is BlabAdapter);
        }
Пример #3
0
 public void Setup()
 {
     _harness   = new BlabAdapter(new MySqlBlab());
     _testEmail = "*****@*****.**";
     _testUser  = new User(_testEmail);
     _testBlab  = new Blab("test", _testUser);
     _harness.RemoveAll();
 }
        public void BuildAdapterPluginTest()
        {
            //Arrange and Act
            BlabServiceFactory _harness1   = new BlabServiceFactory();
            BlabAdapter        blabAdapter = _harness1.CreateBlabAdapter();

            //Assert
            Assert.IsTrue(blabAdapter is BlabAdapter);
        }
Пример #5
0
        public IBlabService CreateBlabService(BlabAdapter adpater = null)
        {
            if (adpater == null)
            {
                adpater = this.CreateBlabAdapter();
            }

            return(new BlabService(adpater));
        }
Пример #6
0
        public void TestRemoveAll()
        {
            //Arrange
            BlabAdapter actual   = _harness;
            Blab        blab     = new Blab(_message, _testUser);
            User        mockUser = new User("*****@*****.**");
            Blab        blabTwo  = new Blab(_message, mockUser);

            //Act
            _harness.Add(blab);
            _harness.Add(blabTwo);
            _harness.RemoveAll();
            //Assert
            Assert.AreEqual(_harness.ToString(), actual.ToString());
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            UserServiceFactory userServiceFactory = new UserServiceFactory();
            IUserPlugin        userPlugin         = userServiceFactory.CreateUserPlugin("mysql");
            UserAdapter        userAdapter        = userServiceFactory.CreateUserAdapter(userPlugin);
            UserService        userService        = userServiceFactory.CreateUserService(userAdapter);

            BlabServiceFactory blabServiceFactory = new BlabServiceFactory();
            IBlabPlugin        blabPlugin         = blabServiceFactory.CreateBlabPlugin("mysql");
            BlabAdapter        blabAdapter        = blabServiceFactory.CreateBlabAdapter(blabPlugin);
            BlabService        blabService        = blabServiceFactory.CreateBlabService(blabAdapter);

            services.AddSingleton <IUserService>(s => userService);
            services.AddSingleton <IBlabService>(s => blabService);
            services.AddRazorPages();
        }
        public void TestAddAndGetBlab()
        {
            BlabAdapter _harness = new BlabAdapter(new MySqlBlab());
            //Arrange
            string email    = "*****@*****.**";
            User   mockUser = new User(email);
            Blab   blab     = new Blab(mockUser, "Now is the time for, blabs...");

            //Act
            _harness.Add(blab);
            ArrayList actual = (ArrayList)_harness.GetByUserId(email);

            //Assert
            Assert.AreEqual(1, actual.Count);
            _harness.Remove(blab);
        }
 public BlabService(BlabAdapter adapter)
 {
     _adapter = adapter;
 }
Пример #10
0
 public void Setup()
 {
     _harness = new BlabAdapter(new MySqlBlab());
     _harness.RemoveAll();
 }
Пример #11
0
 //Constructor
 public BlabAdapter_MySql_UnitTests()
 {
     this._harness = new BlabAdapter(new MySqlBlab());
 }
        public void BuildMySqlPluginLowerCase()
        {
            BlabAdapter blabAdapter = harness.CreateBlabAdapter(harness.CreateBlabPlugin("mysql"));

            Assert.IsTrue(blabAdapter is BlabAdapter);
        }
        public void BuildMySqlPlugin()
        {
            BlabAdapter blabAdapter = harness.CreateBlabAdapter(harness.CreateBlabPlugin("MYSQL"));

            Assert.IsTrue(blabAdapter is BlabAdapter);
        }
Пример #14
0
 /// <summary>
 /// Initializes the service with an adapter
 /// </summary>
 /// <param name="adapter"></param>
 public BlabService(BlabAdapter adapter)
 {
     this.adapter = adapter;
 }
Пример #15
0
 //Constructor
 public BlabAdapter_InMemory_UnitTests()
 {
     this._harness = new BlabAdapter(new InMemory());
 }
 public void Setup()
 {
     newUser = new User(userEmail);
     newBlab = new Blab(blabMessage, newUser);
     adapter = new BlabAdapter(new SqlBlab());
 }