Пример #1
0
        public static IFeatureA Instance(ICoreStore coreStore)
        {
            if (FeatureAInstance == null)
            {
                FeatureAInstance = new FeatureA(coreStore);
            }

            return(FeatureAInstance);
        }
Пример #2
0
        public static IFeatureA Instance()
        {
            if (FeatureAInstance == null)
            {
                FeatureAInstance = new FeatureA();
            }

            return(FeatureAInstance);
        }
Пример #3
0
        //[TestCase(ExpectedResult = "Pluto")]
        public void CreateWithValidInput()
        {
            // ARANGE
            DTOModelA modelA = new DTOModelA
            {
                Id      = 1,
                Name    = "Pippo",
                Surname = "Foia",
            };

            //IModelA modelASubstitute = Substitute.For<IModelA>();
            //modelASubstitute.Id = 3;
            //modelASubstitute.Name = "Pluto";
            //modelASubstitute.Surname = "Paperino";

            IFeatureA featureASubstitute = Substitute.For <FeatureA>();
            //featureASubstitute.DetailsGet(Arg.Any<VMDetailsA>()).Returns(vmDetailsA);

            //IBusinessStore businessStoreSubstitute = Substitute.For<IBusinessStore>();
            //businessStoreSubstitute.GetOperatorA().Returns(operatorASubstitute);

            ICoreSupplier coreSupplierSubstitute = Substitute.For <ICoreSupplier>();

            coreSupplierSubstitute.GetFeatureA.Returns(featureASubstitute);

            IWebStore webStoreSubstitute = Substitute.For <IWebStore>();

            webStoreSubstitute.WebStore_CoreSupplierInstance.Returns(coreSupplierSubstitute);

            // ACT
            var          homeController = new ControllerA(webStoreSubstitute);
            ActionResult result         = homeController.List();

            // ASSERT
            Assert.IsInstanceOf <ViewResult>(result);
            Assert.IsInstanceOf <DTOModelA>((result as ViewResult).Model);
            //Assert.AreEqual(vmDetailsA, ((VMCreateA)(result as ViewResult).Model));

            //OperatorA operatorA = new OperatorA(new DataSupplierMock());

            //AController aController = new AController(new BusinessSupplierMock());
            //IModelA value = aController.operatorA.ReadModel(2);

            //viewModelA = operatorA.ReadModel(2);

            //Assert.IsInstanceOf<IModelA>(viewModelA);
            //Assert.AreEqual(3, viewModelA.Id);
            //Assert.AreEqual("Pluto", viewModelA.Name);
            //Assert.AreEqual("Paperino", viewModelA.Surname);

            //return viewModelA.Name;
        }