Esempio n. 1
0
        public void Add_AddResourceToInventoryWithThisResource_PropContains2UnitsOfResource()
        {
            // ARRANGE
            const int inventoryCount = 1;
            const int testedCount    = 1;
            const int expectedCount  = inventoryCount + testedCount;

            var testedScheme = new PropScheme();

            var props = new IProp[] {
                new Resource(testedScheme, inventoryCount)
            };

            var realStore = CreateContainer(props);


            var testedResource = new Resource(testedScheme, testedCount);

            var propTransferStore = new PropTransferStore(realStore);



            // ACT
            propTransferStore.Add(testedResource);


            // ASSERT
            var factProps = propTransferStore.CalcActualItems();

            factProps.Length.Should().Be(1);  // В инвентаре только один стак ресурсов.
            factProps[0].Should().BeOfType <Resource>();
            factProps[0].Scheme.Should().Be(testedScheme);
            ((Resource)factProps[0]).Count.Should().Be(expectedCount);
        }
Esempio n. 2
0
        public void Add_AddResourceToEmptyInventory_PropContainsThisResource()
        {
            // ARRANGE
            const int expectedCount = 1;

            var props     = new IProp[0];
            var realStore = CreateContainer(props);

            var testedScheme   = new PropScheme();
            var testedResource = new Resource(testedScheme, expectedCount);

            var propTransferStore = new PropTransferStore(realStore);



            // ACT
            propTransferStore.Add(testedResource);


            // ASSERT
            var factProps = propTransferStore.CalcActualItems();

            factProps[0].Should().BeOfType <Resource>();
            factProps[0].Scheme.Should().Be(testedScheme);
            ((Resource)factProps[0]).Count.Should().Be(expectedCount);
        }