public void Fakes_are_registered_weakly_and_so_NOT_eligible_for_garbage_collection() { // Given var foo = An.AutoFaked <Foo>(); var bar = TheFake <IBar> .UsedBy(foo); // WeakReference Class Definition (https://docs.microsoft.com/en-us/dotnet/api/system.weakreference?view=netframework-4.8): // References an object while still allowing that object to be reclaimed by garbage collection. // If an object is reclaimed for garbage collection, a new data object is regenerated; // ...otherwise, the object is available to access because of the weak reference var weakReferenceToFoo = new WeakReference(foo); var weakReferenceToBar = new WeakReference(bar); // Then weakReferenceToFoo.Target.Should().Be(foo); weakReferenceToBar.Target.Should().Be(bar); // When foo = null; bar = null; GC.Collect(); // Then weakReferenceToFoo.Target.Should().NotBe(foo); weakReferenceToBar.Target.Should().NotBe(bar); weakReferenceToFoo.Target.Should().NotBeNull(); weakReferenceToBar.Target.Should().NotBeNull(); }
// Use this for initialization void Start() { player = GameObject.Find("Player"); GameObject An; GameObject Sa; AnQueue = new Queue(); SaQueue = new Queue(); startShoot = true; for (int i = 0; i < EmotionNum; i++) { An = Instantiate(AngerUp, Vector2.zero, Quaternion.identity) as GameObject; //An.transform.parent = this.gameObject.transform; An.GetComponent <EmotionBullet>().m_EmotionTurret = this.gameObject; AnQueue.Enqueue(An); An.SetActive(false); Sa = Instantiate(SadUp, Vector2.zero, Quaternion.identity) as GameObject; //Sa.transform.parent = this.gameObject.transform; Sa.GetComponent <EmotionBullet>().m_EmotionTurret = this.gameObject; SaQueue.Enqueue(Sa); Sa.SetActive(false); Debug.Log(AnQueue.Count); } }
/// <summary> /// Affichage de la liste des animaux /// </summary> /// <param name="ListAnimaux"></param> public void affichageList(List <Animal> ListAnimaux) { foreach (IAnimal An in ListAnimaux) { Console.WriteLine(An.GetType().Name + " , " + An.Nom + " , " + An.Cri); } }
public void _3_다중_하트에_적용할수_있는지() { ((HeartContainer)A.HeartContainer().With( A.Heart().With(An.Image().WithFillAmount(0.75f)), A.Heart().With(_image_last))).Replenish(2); Assert.AreEqual(0.25f, _image_last.fillAmount); }
public void _Distributes_Heart_Pieces_Across_Multiple_Unfilled_Hearts() { ((HeartContainer)A.HeartContainer() .With( A.Heart().With(An.Image().WithFillAmount(0.75f)), A.Heart().With(Target))).Replenish(2); Assert.AreEqual(0.25f, Target.fillAmount); }
public void Throws_exception_if_type_has_no_public_constructor() { // When Action autoFakingObjectWithNoPublicConstructor = () => An.AutoFaked <ObjectWithNoPublicConstructor>(); // Then autoFakingObjectWithNoPublicConstructor.Should().Throw <AutoFakeCreationException>().Which.Message.Should().Contain("no public constructor"); }
public void Throws_exception_if_parameters_cannot_be_faked() { // When Action autoFakingObjectWithUnfakeableDependencies = () => An.AutoFaked <ObjectWithUnfakeableDependencies>(); // Then autoFakingObjectWithUnfakeableDependencies.Should().Throw <AutoFakeCreationException>().Which.Message.Should().Contain("no constructor had parameters that were all fakeable"); }
public void _2_Sets_Full_Image_To_75_Percent_Fill_After_Distrubution() { ((HeartContainer)A.HeartContainer() .With( A.Heart().With(Target), A.Heart() .With(An.Image().WithFillAmount(0.25f)))).Deplete(2); Assert.AreEqual(0.75f, Target.fillAmount); }
public void It_starts_with_the_first_scene() { var scene = new StoryScene(); var engine = An.Engine().WithScene(scene).Build(); engine.NextScene(); Assert.AreEqual(engine.CurrentScene, scene); }
public void _DISTRIBUTES_HEART_PIECES_ACROSS_MULTIPLE_UNFILLED_HEARTS() { ((HeartContainer)A.HeartContainer().With( A.Heart().With(An.Image().WithFillAmount(1f)), A.Heart().With(Target))) .Replenish(2); Assert.AreEqual(0.5f, Target.fillAmount); }
public void _2_SETS_FULL_IMAGE_TO_75_PERCENT_FILL_AFTER_DISTRIBUATION() { ((HeartContainer)A.HeartContainer() .With( A.Heart().With(An.Image().WithFillAmount(1)), A.Heart().With(Target) )).Deplate(1); Assert.AreEqual(0.75f, Target.fillAmount); }
public void _Empty_Hearts_Are_Replenished() { ((HeartContainer)A.HeartContainer() .With( A.Heart().With(An.Image().WithFillAmount(1)), A.Heart().With(Target))).Replenish(1); Assert.AreEqual(0.25f, Target.fillAmount); }
public Given_builders() { var product = A.Product().With().Code("1Eqa").Named("Jacket").Build(); var order = An.Order().Was().StatedAs("Pending").Had().Product(product).CreatedAt(DateTime.Now). By.Customer().Named("Jack").With().AccountNumber("123").LocatedAt(7).Build(); UseThe(order); }
public void _1_두개의_하트에서_깍을때의_테스트() { ((HeartContainer)A.HeartContainer().With( A.Heart().With(target), A.Heart().With(An.Image().WithFillAmount(0.25f) ))). Deplete(2); Assert.AreEqual(0.75f, target.fillAmount); }
Tables() : base(IsReference.Default.Get(Type <TIn> .Instance) ? Start.A.Generic(typeof(ReferenceTables <,>)) .Of.Type <ISelect <Func <TIn, TOut>, ITable <TIn, TOut> > >() .In(An.Array(A.Type <TIn>(), A.Type <TOut>())) .Assume() .Assume() : Start.An.Instance(Activations <Func <TIn, TOut>, ConcurrentTables <TIn, TOut> > .Default) .Select(x => x.Get(new ConcurrentDictionary <TIn, TOut>()))) { }
public void when_a_constructor_argument_is_invalid_then_an_exception_is_thrown() { An <ArgumentNullException> .ShouldBeThrownBy(() => new InMemoryCertificate(null, 2.seconds(), new ControllableTimeProvider())); An <ArgumentException> .ShouldBeThrownBy(() => new InMemoryCertificate(new X509Certificate2(), 0.seconds(), new ControllableTimeProvider())); An <ArgumentException> .ShouldBeThrownBy(() => new InMemoryCertificate(new X509Certificate2(), new TimeSpan(-1L), new ControllableTimeProvider())); An <ArgumentNullException> .ShouldBeThrownBy(() => new InMemoryCertificate(new X509Certificate2(), 2.seconds(), null)); }
public void Exception_thrown_if_no_fake_is_registered_for_type() { // Given var foo = An.AutoFaked <Foo>(); // When Action retrievingBaz = () => TheFake <IBaz> .UsedBy(foo); // Then retrievingBaz.Should().Throw <FakeRetrievalException>().Which.Message.Should().Contain("did not use a fake of type"); }
public ReferenceTables(Type type) : base(Start.A.Generic(type) .Of.Type <ITable <TIn, TOut> >() .WithParameterOf <Func <TIn, TOut> >() .Then() .Bind(An.Array(typeof(TIn), typeof(TOut))) .Get() .Then() .Assume() ) { }
public void BeforeTests() { _image_last = An.Image(); _image_last.fillAmount = 0f; _image_first = An.Image(); _image_first.fillAmount = 0f; _heartContainer = new HeartContainer(new List <Heart> { A.Heart().With(_image_first), A.Heart().With(_image_last), }); }
public void _Empty_Hearts_Are_Replenished() { // Target.fillAmount = 0; // var image = new GameObject().AddComponent<Image>(); // image.fillAmount = 1; // var heartContainer = new HeartContainer( // new List<Heart> {new Heart(image), new Heart(Target)}); // heartContainer.Replenish(1); ((HeartContainer)A.HeartContainer() .With( A.Heart().With(An.Image().WithFillAmount(1)), A.Heart().With(Target))).Replenish(1); Assert.AreEqual(0.25f, Target.fillAmount); }
static void Main(string[] args) { Animal[] Zoo = genZoo(); //Создание массива животных foreach (Animal An in Zoo) //Вывод массива на экран { Console.WriteLine(An.Descript()); if (An is IJump) //Если животное умеет прыгать { Console.WriteLine(((IJump)An).Jump()); } if (An is IRun) //Если животное умеет бегать { Console.WriteLine(((IRun)An).Run()); } } Console.ReadKey(); }
public void SetNote(string sirNote) { int index, an = 0; string [] s_note; s_note = sirNote.Split(','); string[] note_AN; foreach (var An in s_note) { index = -1; note_AN = An.Split(' '); foreach (var nota_int in note_AN) { index++; note[an][index] = Convert.ToInt32(nota_int); } an++; } }
public void when_a_constructor_argument_is_invalid_then_an_exception_is_thrown() { var timeProvider = new Mock <ITimeProvider>().Object; var certificateProvider = new Mock <ICertificateProvider>().Object; An <ArgumentNullException> .ShouldBeThrownBy(() => new AzureKeyVaultCertificateStore(null, certificateProvider, certificateProvider, certificateProvider, timeProvider, 1.seconds())); An <ArgumentNullException> .ShouldBeThrownBy(() => new AzureKeyVaultCertificateStore(certificateProvider, null, certificateProvider, certificateProvider, timeProvider, 1.seconds())); An <ArgumentNullException> .ShouldBeThrownBy(() => new AzureKeyVaultCertificateStore(certificateProvider, certificateProvider, null, certificateProvider, timeProvider, 1.seconds())); An <ArgumentNullException> .ShouldBeThrownBy(() => new AzureKeyVaultCertificateStore(certificateProvider, certificateProvider, certificateProvider, null, timeProvider, 1.seconds())); An <ArgumentNullException> .ShouldBeThrownBy(() => new AzureKeyVaultCertificateStore(certificateProvider, certificateProvider, certificateProvider, certificateProvider, null, 1.seconds())); An <ArgumentNullException> .ShouldBeThrownBy(() => new AzureKeyVaultCertificateStore(certificateProvider, certificateProvider, certificateProvider, certificateProvider, null, 0.seconds())); An <ArgumentNullException> .ShouldBeThrownBy(() => new AzureKeyVaultCertificateStore(certificateProvider, certificateProvider, certificateProvider, certificateProvider, null, new TimeSpan(-1L))); }
public void Fakes_are_registered_weakly_and_so_eligible_for_garbage_collection() { // Given var foo = An.AutoFaked <Foo>(); var bar = TheFake <IBar> .UsedBy(foo); var weakReferenceToFoo = new WeakReference(foo); var weakReferenceToBar = new WeakReference(bar); // When // ReSharper disable RedundantAssignment foo = null; bar = null; // ReSharper restore RedundantAssignment GC.Collect(); // Then weakReferenceToFoo.Target.Should().BeNull(); weakReferenceToBar.Target.Should().BeNull(); }
public HeartBuilder() : this(An.Image()) { }
public void BeforeEveryTest() { Target = An.Image().WithFillAmount(1); }
public void when_expiration_date_has_passed_then_getting_the_value_throws_an_exception() { timeProvider.Now = timeProvider.Now + certificateInMemLifeSpan + 1.seconds(); An <Exception> .ShouldBeThrownBy(() => certificate.X509); }
public void BeforeEveryTest() { Target = An.Image(); }
public static T New <T>(params object[] parms) { return(An.Instance <T>(parms)); }
public void It_requires_a_scene_to_start() { Assert.Throws <ArgumentNullException>(() => An.Engine().Build()); }