public async Task Given_RoomNameAndUserName_When_RoomNameAlreadyExists_Then_CreateRoomShouldNotCreateARoom() { Assert.False(DbInMemorySqlite.Rooms.Any()); DatabaseSetup.AddUser(DbInMemorySqlite); _messageHub = new MessageHub(DbInMemorySqlite); AssignToHubRequiredProperties(_messageHub); await _messageHub.CreateRoom(new RoomModel { RoomName = "RoomieGroomie", UserName = "******", Category = ItemCategory.categories[0] }, new ItemModel { Name = "Flowers", Category = ItemCategory.categories[0], Description = "A flower", URL = "flowerurlhahahehe.com" }); await DbInMemorySqlite.SaveChangesAsync(); await _messageHub.CreateRoom(new RoomModel { RoomName = "RoomieGroomie", UserName = "******", Category = ItemCategory.categories[0] }, new ItemModel { Name = "Flowers", Category = ItemCategory.categories[0], Description = "A flower", URL = "flowerurlhahahehe.com" }); await DbInMemorySqlite.SaveChangesAsync(); Assert.True(DbInMemorySqlite.Rooms.Count() == 1); }
public async Task Given_RoomNameAndUserName_When_InvalidLengthRoomName_Then_CreateRoomShouldNotCreateARoom() { Assert.False(DbInMemorySqlite.Rooms.Any()); DatabaseSetup.AddUser(DbInMemorySqlite); _messageHub = new MessageHub(DbInMemorySqlite); AssignToHubRequiredProperties(_messageHub); await _messageHub.CreateRoom(new RoomModel { RoomName = "Rooo", UserName = "******", Category = ItemCategory.categories[0] }, new ItemModel { Name = "Flowers", Category = ItemCategory.categories[0], Description = "A flower", URL = "flowerurlhahahehe.com" }); Assert.False(DbInMemorySqlite.Rooms.Any()); }
public async Task Given_UserName_When_ValidUserName_And_UserHasRooms_Then_GetUserRoomsShouldReturnUserRooms() { Assert.False(DbInMemorySqlite.Rooms.Any()); DatabaseSetup.AddUser(DbInMemorySqlite); _messageHub = new MessageHub(DbInMemorySqlite); AssignToHubRequiredProperties(_messageHub); await _messageHub.CreateRoom(new RoomModel { RoomName = "RoomieGroomie", UserName = "******", Category = ItemCategory.categories[0] }, new ItemModel { Name = "Flowers", Category = ItemCategory.categories[0], Description = "A flower", URL = "flowerurlhahahehe.com" }); var roomFromDb = _messageHub.GetUserRooms("Vasea"); Assert.NotNull(roomFromDb); }
public async Task Given_RoomNameAndUserName_ValidArguments_Then_DeleteRoomShouldDeleteRoom() { Assert.False(DbInMemorySqlite.Rooms.Any()); DatabaseSetup.AddUser(DbInMemorySqlite); _messageHub = new MessageHub(DbInMemorySqlite); AssignToHubRequiredProperties(_messageHub); await _messageHub.CreateRoom(new RoomModel { RoomName = "RoomieGroomie", UserName = "******", Category = ItemCategory.categories[0] }, new ItemModel { Name = "Flowers", Category = ItemCategory.categories[0], Description = "A flower", URL = "flowerurlhahahehe.com" }); DbInMemorySqlite.ChangeTracker.Clear(); await _messageHub.DeleteRoom("RoomieGroomie", "Vasea"); Assert.False(DbInMemorySqlite.Rooms.Any()); }
public async Task Given_RoomNameAndUserName_When_InvalidRoomName_Then_JoinRoomShouldNotAddUserInRoom() { Assert.False(DbInMemorySqlite.Rooms.Any()); DatabaseSetup.AddUser(DbInMemorySqlite); _messageHub = new MessageHub(DbInMemorySqlite); AssignToHubRequiredProperties(_messageHub); await _messageHub.CreateRoom(new RoomModel { RoomName = "RoomieGroomie", UserName = "******", Category = ItemCategory.categories[0] }, new ItemModel { Name = "Flowers", Category = ItemCategory.categories[0], Description = "A flower", URL = "flowerurlhahahehe.com" }); await _messageHub.JoinRoom("CameraCareNuExista", "Vasea"); var userFromDb = DbInMemorySqlite.Users.FirstOrDefault(); Assert.Null(userFromDb.Room); }
public async Task Given_RoomNameAndUserName_When_InvalidUserName_Then_CreateRoomShouldNotCreateARoom() { Assert.False(DbInMemorySqlite.Rooms.Any()); DatabaseSetup.AddUser(DbInMemorySqlite); _messageHub = new MessageHub(DbInMemorySqlite); AssignToHubRequiredProperties(_messageHub); await _messageHub.CreateRoom(new RoomModel { RoomName = "RoomieGroomie", UserName = "******", Category = ItemCategory.categories[0] }, new ItemModel { Name = "Flowers", Category = ItemCategory.categories[0], Description = "A flower", URL = "flowerurlhahahehe.com" }); var roomFromDb = DbInMemorySqlite.Rooms.FirstOrDefault(); var itemFromDb = DbInMemorySqlite.Items.FirstOrDefault(); Assert.Null(roomFromDb); Assert.Null(itemFromDb); }