public async Task ItemsCreated_TestAsync()
        {
            var authentication = await this.TestContext.LoginRandomAsync(Authority.Admin);

            var expectedDataBaseName = await dataBaseContext.GenerateNewDataBaseNameAsync();

            var expectedComment    = RandomUtility.NextString();
            var actualDataBaseName = string.Empty;
            var actualComment      = string.Empty;
            await dataBaseContext.AddItemsCreatedEventHandlerAsync(DataBaseContext_ItemsCreated);

            await dataBaseContext.AddNewDataBaseAsync(authentication, expectedDataBaseName, expectedComment);

            Assert.AreEqual(expectedDataBaseName, actualDataBaseName);
            Assert.AreEqual(expectedComment, actualComment);

            await dataBaseContext.RemoveItemsCreatedEventHandlerAsync(DataBaseContext_ItemsCreated);

            await dataBaseContext.AddNewRandomDataBaseAsync(authentication);

            Assert.AreEqual(expectedDataBaseName, actualDataBaseName);
            Assert.AreEqual(expectedComment, actualComment);

            void DataBaseContext_ItemsCreated(object sender, ItemsCreatedEventArgs <IDataBase> e)
            {
                var dataBaseInfo = (DataBaseInfo)e.Arguments.Single();

                actualDataBaseName = dataBaseInfo.Name;
                actualComment      = dataBaseInfo.Comment;
            }
        }
Exemple #2
0
        public async Task Name_TestAsync()
        {
            var authentication = await this.TestContext.LoginRandomAsync(Authority.Admin);

            var dataBase1 = await dataBaseContext.AddNewRandomDataBaseAsync(authentication);

            var dataBase2 = await dataBaseContext.GetDataBaseAsync(dataBase1.Name);

            Assert.AreEqual(dataBase1.Name, dataBase2.Name);
        }