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 SignalboxClassCopyMethodReturnsObjectWithCorrectIdProperty()
        {
            Signalbox sourceObject = SignalboxHelpers.GetSignalbox();

            Signalbox testObject = sourceObject.Copy();

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

            Signalbox testObject = sourceObject.Copy();

            Assert.AreNotSame(sourceObject, testObject);
        }
Exemple #5
0
        public void SignalboxCollectionClassIndexerWithIntParameterSetsCorrectObject()
        {
            List <Signalbox>    testData       = SignalboxHelpers.GetSignalboxList(1, 64);
            SignalboxCollection testCollection = new SignalboxCollection(testData);
            Signalbox           testObject     = SignalboxHelpers.GetSignalbox();
            int idx = _random.Next(testData.Count);

            testCollection[idx] = testObject;

            Assert.AreSame(testObject, testCollection[idx]);
        }
        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);
            }
        }
Exemple #8
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);
        }
Exemple #9
0
        public void SignalboxCollectionClassIndexerWithIntParameterRaisesSignalboxRemoveEventIfSetIsCalledWithDifferentObject()
        {
            List <Signalbox>    testData       = SignalboxHelpers.GetSignalboxList(1, 64);
            SignalboxCollection testCollection = new SignalboxCollection(testData);
            Signalbox           testObject     = SignalboxHelpers.GetSignalbox();
            int invocations = 0;

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

            testCollection[idx] = testObject;

            Assert.AreEqual(1, invocations);
        }