public void Test_BlobStorage_UploadxDownloadToDisk()
        {
            // Arrange
            var localFilePath = $"{AppDomain.CurrentDomain.BaseDirectory}\\{TestFileName}";

            // Act
            File.WriteAllText(localFilePath, Lorem.GetParagraph());
            _client.UploadBlob(_fullPath, localFilePath).GetAwaiter().GetResult();
            File.Delete(localFilePath);
            _client.DownloadBlob(_fullPath, localFilePath).GetAwaiter().GetResult();

            // Assert
            Assert.True(File.Exists(localFilePath));
            File.Delete(localFilePath);
        }
        public void Test_MemoryCache_GetOrBuild()
        {
            // Arrange
            IMemoryCache cache   = new MemoryCache(new MemoryCacheOptions());
            var          cacheMe = Lorem.GetParagraph();

            Assert.False(cache.Contains("key"));

            // Act
            var cachedItem = cache.GetOrBuild("key", () => cacheMe, TimeSpan.FromSeconds(2));

            // Assert
            Assert.True(cache.Contains("key"));
            Assert.Equal(cachedItem, cacheMe);
            Thread.Sleep(3000);
            Assert.True(cache.Get("key") == null);
        }
예제 #3
0
 public TestMessage()
 {
     Name  = Lorem.GetSentence();
     Stuff = Lorem.GetParagraph();
     Price = Rng.Next(100);
 }
예제 #4
0
 public void Paragraph_Is_A_Non_Null_String()
 {
     Assert.IsTrue(Regex.IsMatch(Lorem.GetParagraph(), @"[ a-z]+"));
 }
예제 #5
0
 public void TestParagraph()
 {
     Regex.IsMatch(Lorem.GetParagraph(), @"[ a-z]+").ShouldBeTrue();
 }
예제 #6
0
 public void TestParagraph()
 {
     Assert.IsTrue(Regex.IsMatch(Lorem.GetParagraph(), @"[ a-z]+"));
 }