public void SignalboxClassCopyMethodReturnsObjectWithCorrectExportDisplayNameProperty()
        {
            Signalbox sourceObject = SignalboxHelpers.GetSignalbox();

            Signalbox testObject = sourceObject.Copy();

            Assert.AreEqual(sourceObject.ExportDisplayName, testObject.ExportDisplayName);
        }
        public void SignalboxClass_CopyToMethod_ThrowsArgumentNullException_IfParameterIsNull()
        {
            Signalbox testObject = SignalboxHelpers.GetSignalbox();

            testObject.CopyTo(null);

            Assert.Fail();
        }
        public void SignalboxClassCopyMethodReturnsDifferentObject()
        {
            Signalbox sourceObject = SignalboxHelpers.GetSignalbox();

            Signalbox testObject = sourceObject.Copy();

            Assert.AreNotSame(sourceObject, testObject);
        }
        public void SignalboxClassCopyMethodReturnsObjectWithCorrectIdProperty()
        {
            Signalbox sourceObject = SignalboxHelpers.GetSignalbox();

            Signalbox testObject = sourceObject.Copy();

            Assert.AreEqual(sourceObject.Id, testObject.Id);
        }
Ejemplo n.º 5
0
        public void SignalboxCollectionClassConstructorWithIEnumerableParameterReturnsCollectionOfCorrectSize()
        {
            List <Signalbox> testData = SignalboxHelpers.GetSignalboxList(0, 64);

            SignalboxCollection collection = new SignalboxCollection(testData);

            Assert.AreEqual(testData.Count, collection.Count);
        }
Ejemplo n.º 6
0
        public void SignalboxCollectionClassCopyMethodReturnsDifferentObject()
        {
            List <Signalbox>    testData         = SignalboxHelpers.GetSignalboxList(0, 64);
            SignalboxCollection sourceCollection = new SignalboxCollection(testData);

            SignalboxCollection testCollection = sourceCollection.Copy();

            Assert.AreNotSame(testCollection, sourceCollection);
        }
Ejemplo n.º 7
0
        public void SignalboxCollectionClassCopyMethodReturnsCollectionOfCorrectSize()
        {
            List <Signalbox>    testData         = SignalboxHelpers.GetSignalboxList(0, 64);
            SignalboxCollection sourceCollection = new SignalboxCollection(testData);

            SignalboxCollection testCollection = sourceCollection.Copy();

            Assert.AreEqual(sourceCollection.Count, testCollection.Count);
        }
Ejemplo n.º 8
0
        public void SignalboxCollectionClassIndexerWithIntParameterReturnsCorrectObject()
        {
            List <Signalbox>    testData       = SignalboxHelpers.GetSignalboxList(1, 64);
            SignalboxCollection testCollection = new SignalboxCollection(testData);
            int idx = _random.Next(testData.Count);

            Signalbox testObject = testCollection[idx];

            Assert.AreSame(testData[idx], testObject);
        }
Ejemplo n.º 9
0
        public void SignalboxCollectionClassConstructorWithIEnumerableParameterReturnsCollectionWithCorrectContents()
        {
            List <Signalbox> testData = SignalboxHelpers.GetSignalboxList(0, 64);

            SignalboxCollection collection = new SignalboxCollection(testData);

            for (int i = 0; i < testData.Count; ++i)
            {
                Assert.AreSame(testData[i], collection[i]);
            }
        }
Ejemplo n.º 10
0
        public void SignalboxCollectionClassCopyMethodReturnsCollectionWhoseContentsHaveCorrectCodeProperties()
        {
            List <Signalbox>    testData         = SignalboxHelpers.GetSignalboxList(0, 64);
            SignalboxCollection sourceCollection = new SignalboxCollection(testData);

            SignalboxCollection testCollection = sourceCollection.Copy();

            for (int i = 0; i < sourceCollection.Count; ++i)
            {
                Assert.AreEqual(sourceCollection[i].Code, testCollection[i].Code);
            }
        }
Ejemplo n.º 11
0
        public void SignalboxCollectionClassCopyMethodReturnsCollectionWhoseContentsAreDifferentObjects()
        {
            List <Signalbox>    testData         = SignalboxHelpers.GetSignalboxList(0, 64);
            SignalboxCollection sourceCollection = new SignalboxCollection(testData);

            SignalboxCollection testCollection = sourceCollection.Copy();

            for (int i = 0; i < sourceCollection.Count; ++i)
            {
                Assert.AreNotSame(sourceCollection[i], testCollection[i]);
            }
        }
Ejemplo n.º 12
0
        public void SignalboxCollectionClassIndexerWithIntParameterDoesNotRaiseSignalboxRemoveEventIfSetIsCalledWithSameObject()
        {
            List <Signalbox>    testData       = SignalboxHelpers.GetSignalboxList(1, 64);
            SignalboxCollection testCollection = new SignalboxCollection(testData);
            int invocations = 0;

            testCollection.SignalboxRemove += new Events.SignalboxEventHandler((o, e) => { invocations++; });
            int idx = _random.Next(testData.Count);

            testCollection[idx] = testData[idx];

            Assert.AreEqual(0, invocations);
        }
        public void SignalboxClass_CopyToMethod_OverwritesExportDisplayNameProperty()
        {
            Signalbox sourceObject = SignalboxHelpers.GetSignalbox();
            Signalbox testObject;

            do
            {
                testObject = SignalboxHelpers.GetSignalbox();
            } while (!AreSignalboxesCompletelyDifferent(sourceObject, testObject));

            sourceObject.CopyTo(testObject);

            Assert.AreEqual(sourceObject.ExportDisplayName, testObject.ExportDisplayName);
        }
        public void SignalboxClass_CopyToMethod_ThrowsArgumentNullExceptionWithCorrectParamNameProperty_IfParameterIsNull()
        {
            Signalbox testObject = SignalboxHelpers.GetSignalbox();

            try
            {
                testObject.CopyTo(null);
                Assert.Fail();
            }
            catch (ArgumentNullException ex)
            {
                Assert.AreEqual("box", ex.ParamName);
            }
        }
Ejemplo n.º 15
0
        public void SignalboxCollectionClassIndexerWithIntParameterRaisesSignalboxRemoveEventWithCorrectEventArgsIfSetIsCalledWithDifferenObject()
        {
            List <Signalbox>    testData       = SignalboxHelpers.GetSignalboxList(1, 64);
            SignalboxCollection testCollection = new SignalboxCollection(testData);
            Signalbox           testObject     = SignalboxHelpers.GetSignalbox();
            Signalbox           capturedBox    = null;

            testCollection.SignalboxRemove += new Events.SignalboxEventHandler((o, e) => { capturedBox = e.Signalbox; });
            int idx = _random.Next(testData.Count);

            testCollection[idx] = testObject;

            Assert.AreSame(testData[idx], capturedBox);
        }