コード例 #1
0
        public void TestRemoveRessourceAsync(IRessourceService manager)
        {
            manager.SetRessource <RessourceString>(new RessourceString("test", "value", CultureInfo.GetCultureInfo(1)));
            var awaitingResult = manager.RemoveRessourceAsync <RessourceString>("test");

            awaitingResult.Wait(100);
            Assert.IsNull(manager.GetRessource <RessourceString>("test"));
            Assert.IsFalse(manager.ContainsRessource <RessourceString>("test"));

            manager.Flush();

            Assert.IsNull(manager.GetRessource <RessourceString>("test"));
            Assert.IsFalse(manager.ContainsRessource <RessourceString>("test"));

            manager.SetRessource <RessourceString>(new RessourceString("test", "value", CultureInfo.GetCultureInfo(1)));
            manager.Flush();

            awaitingResult = manager.RemoveRessourceAsync <RessourceString>("test");
            awaitingResult.Wait(100);

            Assert.IsNull(manager.GetRessource <RessourceString>("test"));
            Assert.IsFalse(manager.ContainsRessource <RessourceString>("test"));

            manager.Flush();

            Assert.IsNull(manager.GetRessource <RessourceString>("test"));
            Assert.IsFalse(manager.ContainsRessource <RessourceString>("test"));
        }
コード例 #2
0
        public void FailRemoveRessourceAsync(IRessourceService manager)
        {
            manager.Invoking(x => x.RemoveRessource <RessourceString>(null)).Should().Throw <ArgumentNullException>();
            Func <Task> call = () => manager.RemoveRessourceAsync <RessourceString>(null);

            call.Should().Throw <ArgumentNullException>();
        }