public void DefaultConstructor() { var ccArray = new CodeContractedArray<int>(); ccArray.Should().NotBeNull(); ccArray.Should().BeAssignableTo<IArray<int>>(); ccArray.Should().BeOfType<CodeContractedArray<int>>(); ccArray.Count.ShouldBeEquivalentTo(0); ccArray.Capacity.ShouldBeEquivalentTo(0); }
public void TestInitialize() { Alphabet = new CodeContractedArray<char>("abcdefghijklmnopqrstuvwxyz".ToCharArray()); Alphabet.Count.ShouldBeEquivalentTo(26); //This is system wide and preferred way to intercept Contract violations Contract.ContractFailed += (sender, e) => { Assert.Fail($"Contract Failed with message {e.Message}"); }; }
public void CapacityConstructor() { const int CAPACITY = 12; var ccArray = new CodeContractedArray<string>(-1); ccArray.Should().NotBeNull(); ccArray.Should().BeAssignableTo<IArray<string>>(); ccArray.Should().BeOfType<CodeContractedArray<string>>(); ccArray.Count.ShouldBeEquivalentTo(0); ccArray.Capacity.ShouldBeEquivalentTo(CAPACITY); }
public void IntialDataConstructor() { IList<float> initalData = new List<float>{ 1F, 1.2F, 2, 2.66F}; var ccArray = new CodeContractedArray<float>(initalData); ccArray.Should().NotBeNull(); ccArray.Should().BeAssignableTo<IArray<float>>(); ccArray.Should().BeOfType<CodeContractedArray<float>>(); ccArray.Count.ShouldBeEquivalentTo(initalData.Count); ccArray.Capacity.ShouldBeEquivalentTo(initalData.Count); }