public async Task GamesBlobCRUD() { string playerID = $"testPlayer{DateTime.UtcNow.Ticks}"; string content = await _blobService.DownloadGamesBlobContent(playerID); Assert.IsNull(content); var games = new GameBlobObject[0]; await _blobService.UploadGamesBlobContent(playerID, JsonConvert.SerializeObject(games)); content = await _blobService.DownloadGamesBlobContent(playerID); Assert.AreEqual("[]", content); games = new GameBlobObject[] { new GameBlobObject { PlayerID = playerID, PlayerName = "Test Player", Season = 2000, Date = new DateTime(2000, 1, 1), Points = 5 }, new GameBlobObject { PlayerID = playerID, PlayerName = "Test Player", Season = 2000, Date = new DateTime(2000, 1, 2), Points = 10 } }; await _blobService.UploadGamesBlobContent(playerID, JsonConvert.SerializeObject(games)); content = await _blobService.DownloadGamesBlobContent(playerID); CollectionAssert.AreEqual(games, JsonConvert.DeserializeObject <GameBlobObject[]>(content)); await _blobService.DeleteBlob($"{playerID}.json"); content = await _blobService.DownloadGamesBlobContent(playerID); Assert.IsNull(content); }
public void Equals() { var game1 = new GameBlobObject { ID = "player1 2000/1/1", PlayerID = "player1", PlayerName = "Player 1", Season = 2000, Date = new DateTime(2000, 1, 1), Points = 15 }; var game2 = new GameBlobObject { ID = "player1 2000/1/1", PlayerID = "player1", PlayerName = "Player 1", Season = 2000, Date = new DateTime(2000, 1, 1), Points = 15 }; Assert.IsTrue(game1 != game2); Assert.IsTrue(game1.Equals(game2)); game1.TotalRebounds = 10; Assert.IsFalse(game1.Equals(game2)); game2.TotalRebounds = 10; Assert.IsTrue(game1.Equals(game2)); Assert.IsTrue(game2.Equals(game1)); game2.Date = new DateTime(2000, 1, 2); Assert.IsFalse(game1.Equals(game2)); Assert.IsFalse(game2.Equals(game1)); }