コード例 #1
0
        public void SwapCopiesTheCorrectPositionIntoAnotherInstance()
        {
            //Arrange
            var keeper  = new StringKeeper("test");
            var keeper2 = new StringKeeper(keeper);

            keeper.TakeAll();

            //Act
            keeper.Swap(keeper2);

            //Assert
            keeper2.Finished.Should().BeTrue();
        }
コード例 #2
0
        public void SwapImportsTheDetailsFromTheOtherInstance()
        {
            //Arrange
            var keeper    = new StringKeeper("test");
            var keeper2   = new StringKeeper(keeper);
            var takenData = keeper.TakeAll(); //keeper is now finished

            //Act
            keeper.Swap(keeper2);

            //Assert
            var result = keeper.TakeAll(); //if swap did not change keeper, this will return string.Empty

            result.Should().Be(takenData);
        }