Esempio n. 1
0
            public void GoodItemAndBadItem_ReturnsExpectedWarningMsg()
            {
                // arrange
                var mockDependents = new MockDependents();
                var testunit       = MakeTestsLogic(true, ref mockDependents);
                var fakeUser       = new UserProfile();
                var testContext    = new UserSelectedContext
                {
                    BranchId   = "FUT",
                    CustomerId = "234567"
                };
                var testImportFile = new OrderImportFileModel()
                {
                    Options = new OrderImportOptions()
                    {
                        FileFormat      = FileFormat.CSV,
                        IgnoreFirstLine = false,
                        Contents        = FileContentType.ItemOnly,
                        CartName        = "TestCart"
                    },
                    Contents = "123456\n234567"
                };
                var expected = "Some items failed to import.  Please check the items in your cart.\r\n";

                // act
                var results = testunit.ImportOrder(fakeUser, testContext, testImportFile);

                // assert
                results.WarningMessage
                .Should()
                .Be(expected);
            }
Esempio n. 2
0
            public void GoodItem_ReturnsExpectedSuccessMsg()
            {
                // arrange
                var mockDependents = new MockDependents();
                var testunit       = MakeTestsLogic(true, ref mockDependents);
                var fakeUser       = new UserProfile();
                var testContext    = new UserSelectedContext {
                    BranchId   = "FUT",
                    CustomerId = "234567"
                };
                var testImportFile = new OrderImportFileModel()
                {
                    Options = new OrderImportOptions()
                    {
                        FileFormat      = FileFormat.CSV,
                        IgnoreFirstLine = false,
                        Contents        = FileContentType.ItemOnly,
                        CartName        = "TestCart"
                    },
                    Contents = "123456"
                };
                var expected = "Import Successful.";

                // act
                var results = testunit.ImportOrder(fakeUser, testContext, testImportFile);

                // assert
                results.SuccessMessage
                .Should()
                .Be(expected);
            }