Exemplo n.º 1
2
        public void Install_should_install_if_a_package_has_not_been_installed_yet()
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var proj = fixture.Freeze<Project>();
            var pwPkg = new ProjectWidePackage("Prig", "2.0.0", proj);
            var mocks = new MockRepository(MockBehavior.Strict);
            {
                var m = mocks.Create<IVsPackageInstallerServices>();
                m.Setup(_ => _.IsPackageInstalledEx(proj, "Prig", "2.0.0")).Returns(false);
                m.Setup(_ => _.IsPackageInstalled(proj, "Prig")).Returns(false);
                fixture.Inject(m);
            }
            {
                var m = mocks.Create<IVsPackageUninstaller>();
                fixture.Inject(m);
            }
            {
                var m = mocks.Create<IVsPackageInstaller>();
                m.Setup(_ => _.InstallPackage(default(string), proj, "Prig", "2.0.0", false));
                fixture.Inject(m);
            }

            var pwInstllr = fixture.NewProjectWideInstaller();


            // Act
            pwInstllr.Install(pwPkg);


            // Assert
            mocks.VerifyAll();
        }
        public void MessageShouldBeSameAfterSerializationAndDeserialization()
        {
            var writer = new BinaryWriter(new MemoryStream());
            IMessageFactory msgFactory = new MessageFactory(new Message[]
                {
                    new ISomeServiceComplexRequest()
                });

            var fixture = new Fixture();
            fixture.Customize<ISomeServiceComplexRequest>(ob =>
                ob.With(x => x.datas,
                    fixture.CreateMany<SubData>().ToList()));
            fixture.Customize<ComplexData>(ob => ob
                .With(x => x.SomeArrString, fixture.CreateMany<string>().ToList())
                .With(x => x.SomeArrRec, fixture.CreateMany<SubData>().ToList()));

            var msg = fixture.CreateAnonymous<ISomeServiceComplexRequest>();

            //serialize and deserialize msg1
            msg.Serialize(writer);
            writer.Seek(0, SeekOrigin.Begin);
            var reader = new BinaryReader(writer.BaseStream);
            Message retMsg = msgFactory.Deserialize(reader);

            retMsg.Should().BeOfType<ISomeServiceComplexRequest>();
            msg.ShouldBeEqualTo((ISomeServiceComplexRequest)retMsg);
        }
        public void AddCreatures_WhenValidIdentifierIsPassed_WritelineShoulbeCalled()
        {
            var mockedFactory = new Mock<ICreaturesFactory>();
            var mockedLogger = new Mock<ILogger>();

            var battleManager = new BattleManager(mockedFactory.Object, mockedLogger.Object);

            var fixture = new Fixture();

            fixture.Customizations.Add(new TypeRelay(typeof(Creature), typeof(Angel)));

            var creature = fixture.Create<Creature>();

            // var creature = new Angel();
            mockedFactory.Setup(x => x.CreateCreature(It.IsAny<string>())).Returns(creature);

            mockedLogger.Setup(x => x.WriteLine(It.IsAny<string>()));

            // The code itself should be refactored. Think about sealed class to be changed or the static method itself
            // You could use an unconstrained Mocking framework
            var identifier = CreatureIdentifier.CreatureIdentifierFromString("Angel(1)");

            // Act
            battleManager.AddCreatures(identifier, 1);

            // Assert
            mockedLogger.Verify(x => x.WriteLine(It.IsAny<string>()), Times.Once);
        }
Exemplo n.º 4
0
        public void SetUp()
        {
            processor = new CellProcessorBase();
            processor.Memory.GetItem<Context>().TestPagePath = @"\some\path.html";

            fixture = new Fixture { Processor = processor };
        }
        public async Task Save_should_update_an_existing_product()
        {
            using (var store = NewDocumentStore())
            {
                using (var session = store.OpenAsyncSession())
                {
                    // Arrange
                    var fixture = new Fixture();
                    var product = fixture.Build<Product>()
                        .With(c => c.Id, "Products-1")
                        .With(c => c.Name, "Mediums")
                        .Create();
                    await SaveEntity(product, session);

                    // Act
                    var dto = new ProductDto {Id = "Products-1", Name = "Updated name"};
                    var service = GetProductsService(session);
                    var model = await service.Save(dto);
                    model.Message.Should().Be("Atualizou tipo Updated name");
                }

                using (var session = store.OpenAsyncSession())
                {
                    var actual = await session.LoadAsync<Product>("Products-1");
                    actual.Name.Should().Be("Updated name");
                }
            }
        }
        public void HasCaption_Should_Add_ModelDefaultAttribute_With_CaptionPropertyName_And_ValueMyCaption()
        {
            var caption = new Fixture().Create<string>();
            _Builder.HasCaption(caption);

            A.CallTo(() => _TypeInfo.AddAttribute(A<ModelDefaultAttribute>.That.Matches(t => t.PropertyName == ModelDefaultKeys.Caption && t.PropertyValue == caption))).MustHaveHappened();
        }
        public void HasImage_Should_Add_ImageNameAttribute()
        {
            var imageName = new Fixture().Create<string>();
            _Builder.HasImage(imageName);

            A.CallTo(() => _TypeInfo.AddAttribute(A<ImageNameAttribute>.That.Matches(t => t.ImageName == imageName))).MustHaveHappened();
        }
            public static TestData Create(bool existingUser = false)
            {
                var fixture = new Fixture();
                var testData = new TestData
                {
                    Fixture = fixture,
                    UserManager = new Mock<IUserManager>(),
                    SystemRoleManager = new Mock<ISystemRoleManager>(),
                    SystemSettings = new Mock<ISystemSettings>(),
                    AdministratorUserName = fixture.Create<string>("UserName"),
                    AdministratorPassword = fixture.Create<string>("Password"),
                    AdministratorEmailAddress = fixture.Create<string>("EmailAddress"),
                    AdministratorRole = fixture.Build<SystemRole>()
                                                .With(i => i.RoleType, EnumSystemRoleType.Administrator)
                                                .Create()
                };
                if (existingUser)
                {
                    testData.ExistingUser = fixture.Build<SrirachaUser>()
                                                    .With(i => i.UserName, testData.AdministratorUserName)
                                                    .Create();
                    testData.UserManager.Setup(i => i.GetUser(testData.ExistingUser.Id)).Returns(testData.ExistingUser);
                    testData.UserManager.Setup(i => i.TryGetUserByUserName(testData.ExistingUser.UserName)).Returns(testData.ExistingUser);
                    testData.UserManager.Setup(i => i.GetUserByUserName(testData.ExistingUser.UserName)).Returns(testData.ExistingUser);
                }
                testData.SystemRoleManager.Setup(i => i.GetBuiltInRole(EnumSystemRoleType.Administrator)).Returns(testData.AdministratorRole);

                testData.Sut = new SystemSetterUpper(testData.UserManager.Object, testData.SystemRoleManager.Object, testData.SystemSettings.Object);

                return testData;
            }
Exemplo n.º 9
0
		public void TestInitialize()
		{
			_context = new DbTestContext(Settings.Default.FilesConnectionString);
			_fixture = new Fixture();

			_repository = new AwbFileRepository(new SqlProcedureExecutor(Settings.Default.FilesConnectionString));
		}
        public async Task GetById_should_retrieve_a_product_from_the_db()
        {
            using (var store = NewDocumentStore())
            {
                using (var session = store.OpenAsyncSession())
                {
                    // Arrange
                    var fixture = new Fixture();
                    var product = fixture.Build<Product>()
                        .With(c => c.Id, "Products-1")
                        .With(c => c.Name, "Mediums")
                        .Create();
                    await SaveEntity(product, session);

                    // Act
                    var service = GetProductsService(session);
                    var actual = await service.GetById("Products-1");

                    // Assert
                    actual.Id.Should().Be("Products-1");
                    actual.Name.Should().Be("Mediums");
                    actual.Count.Should().Be(product.Count);
                    actual.Type.Should().Be(product.Type);
                }
            }
        }
Exemplo n.º 11
0
        public void TestEvaluateCancel()
        {
            // Arrange
              var aFixture = new Fixture();

              var expressionContent = aFixture.Create<string>();
              var expression = new Expression("not", expressionContent);

              var evaluator = new Mock<IExpressionEvaluator>();
              var registry = Mock.Of<IEvaluatorSelector>(x => x.GetEvaluator(It.IsAny<Expression>()) == evaluator.Object);
              evaluator
            .Setup(x => x.Evaluate(It.Is<Expression>(e => e.ToString() == expressionContent),
                               It.IsAny<RenderingContext>(),
                               It.IsAny<TalesModel>()))
            .Returns(new ExpressionResult(ZptConstants.CancellationToken));

              var model = new TalesModel(registry);

              var sut = new NotExpressionEvaluator();

              // Act
              var result = sut.Evaluate(expression, Mock.Of<RenderingContext>(), model);

              // Assert
              Assert.NotNull(result, "Result nullability");
              Assert.AreEqual(true, result.Value, "Correct result");
        }
Exemplo n.º 12
0
        public void Equals_DifferentMovies_ReturnsFalse()
        {
            var fixture = new Fixture();

            var id1 = fixture.Create<int>();
            var dateUploadedUnix1 = fixture.Create<int>();

            var id2 = fixture.Create<int>();
            var dateUploadedUnix2 = fixture.Create<int>();

            var movie1 = new MovieFull
            {
                Id = id1,
                DateUploadedUnix = dateUploadedUnix1
            };

            var movie2 = new MovieFull
            {
                Id = id2,
                DateUploadedUnix = dateUploadedUnix2
            };

            Assert.AreEqual(
                _comparer.Equals(movie1, movie2), false);

            Assert.AreEqual(
                _comparer.Equals(movie1, null), false);

            Assert.AreEqual(
                _comparer.Equals(movie2, null), false);
        }
Exemplo n.º 13
0
            public void Execute(Fixture fixture, Action next)
            {
                foreach (var injectionMethod in fixtures.Keys)
                    injectionMethod.Invoke(fixture.Instance, new[] { fixtures[injectionMethod] });

                next();
            }
Exemplo n.º 14
0
        public void DoTable(Fixture fixture, Parse tables, object[] businessObjects, int right, int wrong, int ignores, int exceptions)
        {
            BusinessObjectRowFixture.objects = businessObjects;
            RunTest(fixture, tables);

            TestUtils.CheckCounts(resultCounts, right, wrong, ignores, exceptions);
        }
Exemplo n.º 15
0
        public bool Read(XmlReader reader)
        {
            if(reader.IsStartElement() && reader.Name == "Fixture") {
                Fixture fixture = new Fixture();

                //...Any attributes go here...
                fixture.AllowFrameSkip = bool.Parse(reader.GetAttribute("allowFrameSkip"));
                fixture.Name = reader.GetAttribute("name");
                // This needs to hold off until after channels are loaded.
                string fixtureDefinitionName = reader.GetAttribute("fixtureDefinitionName");

                if(reader.ElementsExistWithin("Fixture")) { // Entity element
                    // Channels
                    if(reader.ElementsExistWithin("Channels")) { // Container element for child entity
                        ChannelReader<OutputChannel> channelReader = new ChannelReader<OutputChannel>();
                        while(channelReader.Read(reader)) {
                            fixture.InsertChannel(channelReader.Channel);
                        }
                        reader.ReadEndElement(); // Channels
                    }

                    // With channels loaded, the fixture template reference can be set.
                    fixture.FixtureDefinitionName = fixtureDefinitionName;

                    reader.ReadEndElement(); // Fixture

                    this.Fixture = fixture;
                }
                return true;
            }
            return false;
        }
            public async Task CanStoreComplexClient(NpgsqlClientStore store, Fixture fixture, string clientId)
            {
                // Given
                var client = new Client
                {
                    ClientId = clientId,
                    ClientSecrets = fixture.Create<List<ClientSecret>>(),
                    Flow = Flows.AuthorizationCode,
                    Claims = new List<Claim> { new Claim(fixture.Create("type"), fixture.Create("value"))},
                    AccessTokenType = AccessTokenType.Jwt,
                    ClientUri = fixture.Create<string>(),
                    ClientName = fixture.Create<string>(),
                    RequireConsent = false,
                    ScopeRestrictions = fixture.Create<List<string>>(),
                    LogoUri = fixture.Create<string>(),
                    Enabled = true,
                };

                // When
                await store.AddClientAsync(client);

                // Then
                var fromDb = await store.FindClientByIdAsync(clientId);
                fromDb.ShouldNotBe(null);

                fromDb.ClientId.ShouldBe(clientId);
                fromDb.ClientSecrets.Count.ShouldBe(client.ClientSecrets.Count);
                fromDb.Flow.ShouldBe(client.Flow);
                
            }
Exemplo n.º 17
0
        public void StartPacking_should_create_nupkg()
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());
            {
                var m = new Mock<IEnvironmentRepository>(MockBehavior.Strict);
                m.Setup(_ => _.GetNuGetPath()).Returns(AppDomain.CurrentDomain.GetPathInBaseDirectory(@"tools\NuGet.exe"));
                fixture.Inject(m);
            }

            var nugetExecutor = fixture.NewNuGetExecutor();


            // Act
            var result = nugetExecutor.StartPacking(AppDomain.CurrentDomain.GetPathInBaseDirectory(@"tools\NuGet\Prig.nuspec"), AppDomain.CurrentDomain.BaseDirectory);


            // Assert
            var lines = result.Split(new[] { "\r\n" }, StringSplitOptions.None);
            Assert.LessOrEqual(2, lines.Length);
            var match = Regex.Match(lines[1], "'([^']+)'");
            Assert.IsTrue(match.Success);
            var nupkgPath = match.Groups[1].Value;
            Assert.IsTrue(File.Exists(nupkgPath));
            Assert.GreaterOrEqual(TimeSpan.FromSeconds(1), DateTime.Now - File.GetLastWriteTime(nupkgPath));
        }
Exemplo n.º 18
0
 public void MarksSameStringCellAsRight()
 {
     var cell = new Parse("td", "something", null, null);
     var fixture = new Fixture {Processor = new Service.Service()};
     fixture.CellOperation.Check(new TypedValue("something"), cell);
     Assert.AreEqual("\n<td class=\"pass\">something</td>", cell.ToString());
 }
Exemplo n.º 19
0
		public void TestInitialize()
		{
			_context = new DbTestContext(Settings.Default.MainConnectionString);
			_fixture = new Fixture();

			_repository = new SenderRepository(new PasswordConverter(), new SqlProcedureExecutor(Settings.Default.MainConnectionString));
		}
Exemplo n.º 20
0
        public void Execute(Type testClass, Convention convention, Case[] cases)
        {
            foreach (var @case in cases)
            {
                var exceptions = @case.Exceptions;

                try
                {
                    var instance = construct(testClass);

                    var fixture = new Fixture(testClass, instance, convention.CaseExecution.Behavior, new[] { @case });
                    convention.InstanceExecution.Behavior.Execute(fixture);

                    Lifecycle.Dispose(instance);
                }
                catch (PreservedException preservedException)
                {
                    var constructionException = preservedException.OriginalException;
                    exceptions.Add(constructionException);
                }
                catch (Exception constructionException)
                {
                    exceptions.Add(constructionException);
                }
            }
        }
Exemplo n.º 21
0
 public void MarksDifferentStringCellAsWrong()
 {
     var cell = new Parse("td", "something else", null, null);
     var fixture = new Fixture {Processor = new Service.Service()};
     fixture.CellOperation.Check(new TypedValue("something"), cell);
     Assert.AreEqual("\n<td class=\"fail\">something else <span class=\"fit_label\">expected</span><hr />something <span class=\"fit_label\">actual</span></td>", cell.ToString());
 }
        public void WriteFunctionElementHeader_should_not_write_return_type_attribute_for_non_primitive_return_type()
        {
            var fixture = new Fixture();

            var returnParameterType = TypeUsage.CreateDefaultTypeUsage(new RowType());

            var function = new EdmFunction(
                "Foo",
                "Bar",
                DataSpace.SSpace,
                new EdmFunctionPayload
                    {
                        Schema = "dbo",
                        ReturnParameters =
                            new[]
                                {
                                    new FunctionParameter(
                                        "r",
                                        returnParameterType,
                                        ParameterMode.ReturnValue)
                                }
                    });

            fixture.Writer.WriteFunctionElementHeader(function);

            Assert.Equal(
                "<Function Name=\"Foo\" Aggregate=\"false\" BuiltIn=\"false\" NiladicFunction=\"false\" IsComposable=\"true\" ParameterTypeSemantics=\"AllowImplicitConversion\" Schema=\"dbo\"",
                fixture.ToString());
        }
Exemplo n.º 23
0
        public void Given_WhenWhen_ShouldExpectedResult()
        {
            var documentStore = new DocumentStore { Url = "http://mamluka-pc:4253" };
            documentStore.Initialize();

            var fixture = new Fixture();

            using (var session = documentStore.OpenSession())
            {
                var theList = fixture.CreateMany<Contact>(1000).ToList();

                theList.Take(500).ToList().ForEach(x => x.DomainGroup = "a");
                theList.Skip(500).Take(500).ToList().ForEach(x => x.DomainGroup = "b");

                var bigDoc = new Holder
                                 {
                                     TheList = theList
                                 };

                session.Store(bigDoc);
                session.SaveChanges();
            }

            documentStore.DatabaseCommands.PutIndex("Count_Contacts", new IndexDefinitionBuilder<Holder, SummeryOfDomains>
            {
                Map = contacts => contacts.SelectMany(x => x.TheList).Select(x => new { x.DomainGroup, Count = 1 }),
                Reduce = results => results.GroupBy(x => x.DomainGroup).Select(x => new { DomainGroup = x.Key, Count = x.Sum(m => m.Count) })

            }, true);

            using (var session = documentStore.OpenSession())
            {
                Trace.WriteLine(session.Query<List<int>>("Count_Contacts").First());
            }
        }
Exemplo n.º 24
0
        public void SetUp()
        {
            processor = Builder.CellProcessor();
            processor.Memory.GetItem<Context>().TestPagePath = new FilePath(@"\some\path.html");

            fixture = new Fixture { Processor = processor };
        }
Exemplo n.º 25
0
        public Cell CompileCell(CellHandling cellHandling, Fixture fixture)
        {
            _cell = Cell.For(cellHandling, _property, fixture);
            _cell.output = true;

            return _cell;
        }
				public static TestData Create(int projectCount=5)
				{
					var fixture = new Fixture();
					var returnValue = new TestData
					{
						Fixture = fixture,
						UserName = fixture.Create<string>("UserName"),
						ProjectList = fixture.CreateMany<DeployProject>(projectCount).ToList(),
						ProjectRoleManager = new Mock<IProjectRoleManager>(),
                        SystemRoleManager = new Mock<ISystemRoleManager>(),
						UserIdentity = new Mock<IUserIdentity>()
					};
					returnValue.DeployProjectRoleList = 
						(from i in returnValue.ProjectList
						 select new DeployProjectRole
							{
								ProjectId = i.Id,
								RoleName = fixture.Create<string>("RoleName")
							}
						).ToList();
                    returnValue.ProjectRoleManager.Setup(i => i.GetProjectRoleListForUser(It.IsAny<string>())).Returns(new List<DeployProjectRole>());
                    returnValue.ProjectRoleManager.Setup(i => i.GetProjectRoleListForUser(returnValue.UserName)).Returns(returnValue.DeployProjectRoleList);

                    returnValue.SystemRoleManager.Setup(i=>i.GetSystemRoleListForUser(It.IsAny<string>())).Returns(new List<SystemRole>());

					returnValue.UserIdentity.Setup(i=>i.UserName).Returns(returnValue.UserName);

					returnValue.Sut = new PermissionValidator(returnValue.ProjectRoleManager.Object, returnValue.SystemRoleManager.Object, returnValue.UserIdentity.Object);

					return returnValue;
				}
 public void Initialize()
 {
     fixture = new Fixture();
     fixture.Customize<usr_CUSTOMERS>(
         customer =>
         customer.With(x => x.password, Tests.SAMPLE_PASSWORD).With(x => x.email, Tests.SAMPLE_EMAIL_ADDRESS));
 }
Exemplo n.º 28
0
        public void WriteMappingFragment_should_write_store_entity_set_name()
        {
            var fixture = new Fixture();

            var entityType = new EntityType("E", "N", DataSpace.CSpace);
            var entitySet = new EntitySet("ES", "S", null, null, entityType);
            var entityContainer = new EntityContainer("EC", DataSpace.SSpace);

            entityContainer.AddEntitySetBase(entitySet);

            var storageEntitySetMapping
                = new EntitySetMapping(
                    entitySet,
                    new EntityContainerMapping(entityContainer));

            TypeMapping typeMapping = new EntityTypeMapping(storageEntitySetMapping);

            var mappingFragment = new MappingFragment(entitySet, typeMapping, false);

            fixture.Writer.WriteMappingFragmentElement(mappingFragment);

            Assert.Equal(
                @"<MappingFragment StoreEntitySet=""ES"" />",
                fixture.ToString());
        }
Exemplo n.º 29
0
        public FileSyncTests()
        {
            _client = new DropNetClient(TestVariables.ApiKey, TestVariables.ApiSecret);
            _client.UserLogin = new Models.UserLogin { Token = TestVariables.Token, Secret = TestVariables.Secret };

            _fixture = new Fixture();
        }
        public void Setup()
        {
            _fixture = new Fixture();
            _pmGateway = new Mock<IProjectManagerGateway>();
            _projectRepository = new Mock<IProjectRepository>();
            _vcsGateway = new Mock<IVersionControlSystemGateway>();
            _eventSinkMock = new Mock<IEventSink>();
            _userRepository = new Mock<IUserRepository>();
            var paginationSettings = new ProjectManagement.Domain.PaginationSettings(10);

            _pmGateway
                .Setup(pm => pm.CreateProject(It.IsAny<CreateProjectRequest>()))
                .Returns(_fixture.Create<RedmineProjectInfo>());
            _vcsGateway
                .Setup(vcs => vcs.CreateRepositoryForProject(It.IsAny<CreateProjectRequest>()))
                .Returns(_fixture.Create<VersionControlSystemInfo>());
            _projectRepository
                .Setup(repo => repo.SaveProject(It.IsAny<Project>()))
                .Returns(1);
            _userRepository.Setup(repo => repo.GetUserRedmineId(It.IsAny<int>())).Returns(1);
            _userRepository.Setup(repo => repo.GetUserGitlabId(It.IsAny<int>())).Returns(1);
            _projectProvider = new ProjectProvider(
                _pmGateway.Object,
                _vcsGateway.Object,
                _projectRepository.Object,
                _eventSinkMock.Object,
                _userRepository.Object,
                paginationSettings,
                new IssuePaginationSettings(25));
        }
Exemplo n.º 31
0
        public void TestThatImportTranslationCallsTranslationAddOnDomainObjectWhenTranslationForTranslationInfoDoesNotExists()
        {
            var fixture = new Fixture();
            var systemDataRepositoryMock  = MockRepository.GenerateMock <ISystemDataRepository>();
            var foodWasteObjectMapperMock = MockRepository.GenerateMock <IFoodWasteObjectMapper>();
            var specificationMock         = MockRepository.GenerateMock <ISpecification>();
            var commonValidationsMock     = MockRepository.GenerateMock <ICommonValidations>();
            var exceptionBuilderMock      = MockRepository.GenerateMock <IExceptionBuilder>();

            var translationInfoIdentifier = Guid.NewGuid();
            var translationInfoMock       = MockRepository.GenerateMock <ITranslationInfo>();

            translationInfoMock.Stub(m => m.Identifier)
            .Return(translationInfoIdentifier)
            .Repeat.Any();

            var translationIdentifier = Guid.NewGuid();
            var translationValue      = fixture.Create <string>();

            var domainObjectIdentifier = Guid.NewGuid();
            var domainObjectMock       = MockRepository.GenerateMock <ITranslatable>();

            domainObjectMock.Stub(m => m.Identifier)
            .Return(domainObjectIdentifier)
            .Repeat.Any();
            domainObjectMock.Stub(m => m.Translations)
            .Return(new List <ITranslation>(0))
            .Repeat.Any();
            domainObjectMock.Stub(m => m.TranslationAdd(Arg <ITranslation> .Is.NotNull))
            .WhenCalled(e =>
            {
                var translation = (ITranslation)e.Arguments.ElementAt(0);
                Assert.That(translation, Is.Not.Null);
                Assert.That(translation.Identifier, Is.Not.Null);
                Assert.That(translation.Identifier.HasValue, Is.True);
                // ReSharper disable PossibleInvalidOperationException
                Assert.That(translation.Identifier.Value, Is.EqualTo(translationIdentifier));
                // ReSharper restore PossibleInvalidOperationException
                Assert.That(translation.TranslationOfIdentifier, Is.EqualTo(domainObjectIdentifier));
                Assert.That(translation.TranslationInfo, Is.Not.Null);
                Assert.That(translation.TranslationInfo, Is.EqualTo(translationInfoMock));
                Assert.That(translation.Value, Is.Not.Null);
                Assert.That(translation.Value, Is.Not.Empty);
                Assert.That(translation.Value, Is.EqualTo(translationValue));
            })
            .Repeat.Any();

            var logicExecutorMock = MockRepository.GenerateMock <ILogicExecutor>();

            logicExecutorMock.Stub(m => m.TranslationAdd(Arg <ITranslation> .Is.NotNull))
            .Return(translationIdentifier)
            .Repeat.Any();

            var commandHandler = new MyFoodWasteSystemDataCommandHandler(systemDataRepositoryMock, foodWasteObjectMapperMock, specificationMock, commonValidationsMock, exceptionBuilderMock);

            Assert.That(commandHandler, Is.Not.Null);

            commandHandler.ImportTranslation(domainObjectMock, translationInfoMock, translationValue, logicExecutorMock);

            domainObjectMock.AssertWasCalled(m => m.TranslationAdd(Arg <ITranslation> .Is.NotNull));
        }
Exemplo n.º 32
0
 public happy_case_catching_up_to_link_to_events_auto_ack(Fixture fixture)
 {
     _fixture = fixture;
 }
Exemplo n.º 33
0
 public ConfigurationPatternsTest(CrossStoreFixture fixture)
 {
     Fixture           = fixture;
     ExistingTestStore = Fixture.CreateTestStore(SqlServerTestStoreFactory.Instance, StoreName, Seed);
 }
Exemplo n.º 34
0
        protected override IEnumerable <JsonElement> CreateInvalidJson()
        {
            #region String

            var strings = Fixture.Create <DateTime[]>();

            var sb = new StringBuilder();

            sb.Append("[");

            var isFirst = true;

            foreach (var value in strings)
            {
                if (!isFirst)
                {
                    sb.Append(", ");
                }

                sb.Append("\"").Append(value).Append("\"");
                isFirst = false;
            }

            sb.Append("]");

            yield return(JsonSerializer.Deserialize <JsonElement>(
                             $@"{{ ""action"": {{ ""input"": {{ ""value"": {sb} }} }} }}").GetProperty("action"));

            #endregion

            #region Int

            sb.Clear();

            var ints = Fixture.Create <int[]>();

            sb.Append("[");

            isFirst = true;

            foreach (var value in ints)
            {
                if (!isFirst)
                {
                    sb.Append(", ");
                }

                sb.Append(value);
                isFirst = false;
            }

            sb.Append("]");

            yield return(JsonSerializer.Deserialize <JsonElement>(
                             $@"{{ ""action"": {{ ""input"": {{ ""value"": {sb} }} }} }}").GetProperty("action"));

            #endregion

            #region bool

            sb.Clear();

            var bools = Fixture.Create <bool[]>();

            sb.Append("[");

            isFirst = true;

            foreach (var value in bools)
            {
                if (!isFirst)
                {
                    sb.Append(", ");
                }

                sb.Append(value.ToString().ToLower());
                isFirst = false;
            }

            sb.Append("]");

            yield return(JsonSerializer.Deserialize <JsonElement>(
                             $@"{{ ""action"": {{ ""input"": {{ ""value"": {sb} }} }} }}").GetProperty("action"));

            #endregion

            #region Multi Value

            sb.Clear();

            sb = new StringBuilder();

            sb.Append("[")
            .Append(Fixture.Create <bool>().ToString().ToLower())
            .Append(", ")
            .Append(Fixture.Create <int>())
            .Append(", ")
            .Append("\"").Append(Fixture.Create <string>()).Append("\"");

            sb.Append("]");

            yield return(JsonSerializer.Deserialize <JsonElement>(
                             $@"{{ ""action"": {{ ""input"": {{ ""value"": {sb} }} }} }}").GetProperty("action"));

            sb.Clear();

            #endregion
        }
Exemplo n.º 35
0
 public MemoryStreamProviderClientTests(Fixture fixture)
 {
     runner = new ClientStreamTestRunner(fixture.HostedCluster);
 }
Exemplo n.º 36
0
 public virtual TValue CreateValue(TKey key)
 {
     return(Fixture.Create <TValue>());
 }
Exemplo n.º 37
0
 public virtual TKey CreateKey()
 {
     return(Fixture.Create <TKey>());
 }
Exemplo n.º 38
0
 public StorageFacetTests(Fixture fixture)
 {
     this.fixture = fixture;
 }
Exemplo n.º 39
0
 public void SetUp()
 {
     _fixture = new Fixture();
     _random  = new Random(_fixture.Create <int>());
 }
Exemplo n.º 40
0
 public NestedContextDifferentStores(CrossStoreFixture fixture)
 {
     Fixture           = fixture;
     ExistingTestStore = Fixture.CreateTestStore(SqlServerTestStoreFactory.Instance, StoreName, Seed);
 }
Exemplo n.º 41
0
        public void Reset(TimeStep step, int count, Contact[] contacts, Position[] positions, Velocity[] velocities)
        {
            _step       = step;
            _count      = count;
            _positions  = positions;
            _velocities = velocities;
            _contacts   = contacts;

            // grow the array
            if (VelocityConstraints == null || VelocityConstraints.Length < count)
            {
                VelocityConstraints  = new ContactVelocityConstraint[count * 2];
                _positionConstraints = new ContactPositionConstraint[count * 2];

                for (int i = 0; i < VelocityConstraints.Length; i++)
                {
                    VelocityConstraints[i] = new ContactVelocityConstraint();
                }

                for (int i = 0; i < _positionConstraints.Length; i++)
                {
                    _positionConstraints[i] = new ContactPositionConstraint();
                }
            }

            // Initialize position independent portions of the constraints.
            for (int i = 0; i < _count; ++i)
            {
                Contact contact = contacts[i];

                Fixture  fixtureA = contact.FixtureA;
                Fixture  fixtureB = contact.FixtureB;
                Shape    shapeA   = fixtureA.Shape;
                Shape    shapeB   = fixtureB.Shape;
                float    radiusA  = shapeA.Radius;
                float    radiusB  = shapeB.Radius;
                Body     bodyA    = fixtureA.Body;
                Body     bodyB    = fixtureB.Body;
                Manifold manifold = contact.Manifold;

                int pointCount = manifold.PointCount;
                Debug.Assert(pointCount > 0);

                ContactVelocityConstraint vc = VelocityConstraints[i];
                vc.Friction     = contact.Friction;
                vc.Restitution  = contact.Restitution;
                vc.TangentSpeed = contact.TangentSpeed;
                vc.IndexA       = bodyA.IslandIndex;
                vc.IndexB       = bodyB.IslandIndex;
                vc.InvMassA     = bodyA._invMass;
                vc.InvMassB     = bodyB._invMass;
                vc.InvIA        = bodyA._invI;
                vc.InvIB        = bodyB._invI;
                vc.ContactIndex = i;
                vc.PointCount   = pointCount;
                vc.K.SetZero();
                vc.NormalMass.SetZero();

                ContactPositionConstraint pc = _positionConstraints[i];
                pc.IndexA       = bodyA.IslandIndex;
                pc.IndexB       = bodyB.IslandIndex;
                pc.InvMassA     = bodyA._invMass;
                pc.InvMassB     = bodyB._invMass;
                pc.LocalCenterA = bodyA._sweep.LocalCenter;
                pc.LocalCenterB = bodyB._sweep.LocalCenter;
                pc.InvIA        = bodyA._invI;
                pc.InvIB        = bodyB._invI;
                pc.LocalNormal  = manifold.LocalNormal;
                pc.LocalPoint   = manifold.LocalPoint;
                pc.PointCount   = pointCount;
                pc.RadiusA      = radiusA;
                pc.RadiusB      = radiusB;
                pc.Type         = manifold.Type;

                for (int j = 0; j < pointCount; ++j)
                {
                    ManifoldPoint           cp  = manifold.Points[j];
                    VelocityConstraintPoint vcp = vc.Points[j];

#pragma warning disable 162
                    // ReSharper disable once ConditionIsAlwaysTrueOrFalse
                    if (Settings.EnableWarmstarting)
                    {
                        vcp.NormalImpulse  = _step.dtRatio * cp.NormalImpulse;
                        vcp.TangentImpulse = _step.dtRatio * cp.TangentImpulse;
                    }
                    else
                    {
                        vcp.NormalImpulse  = 0.0f;
                        vcp.TangentImpulse = 0.0f;
                    }
#pragma warning restore 162

                    vcp.rA           = Vector2.Zero;
                    vcp.rB           = Vector2.Zero;
                    vcp.NormalMass   = 0.0f;
                    vcp.TangentMass  = 0.0f;
                    vcp.VelocityBias = 0.0f;

                    pc.LocalPoints[j] = cp.LocalPoint;
                }
            }
        }
Exemplo n.º 42
0
 public PersistenceStateTests_AzureTableGrainStorage(ITestOutputHelper output, Fixture fixture) :
     base(output, fixture, "UnitTests.Grains.PersistentState")
 {
     fixture.EnsurePreconditionsMet();
 }
 public void MSTest_AutoData_LocateData(Fixture fixture, [Locate] int locate)
 {
     fixture.Locate <int>().Should().Be(locate);
 }
Exemplo n.º 44
0
        protected override void Seed(LFCMVC.Models.LFCContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //

            //create Competitions
            var competitions = new List<Competition>();
            Competition epl = new Competition();
            epl.CompetitionId = 1;
            epl.Image = "epl.png";
            epl.Name = "English Premiership";
            competitions.Add(epl);

            Competition fa = new Competition();
            fa.CompetitionId = 2;
            fa.Image = "facup.png";
            fa.Name = "FA Cup";
            competitions.Add(fa);

            Competition capital = new Competition();
            capital.Image = "capcup.png";
            capital.CompetitionId = 3;
            capital.Name = "Capital One Cup";
            competitions.Add(capital);

            Competition europa = new Competition();
            europa.CompetitionId = 4;
            europa.Image = "uel.png";
            europa.Name = "Europa League";
            competitions.Add(europa);

            Competition friendly = new Competition();
            friendly.CompetitionId = 5;
            friendly.Image = "friendly.png";
            friendly.Name = "Friendly";
            competitions.Add(friendly);

            context.SaveChanges();

            //create Player Positions
            var positions = new List<PlayerPosition>();
            PlayerPosition gk = new PlayerPosition();
            gk.PlayerPositionId = 1;
            gk.Position = "GK";
            gk.Description = "Goalkeeper";
            positions.Add(gk);

            PlayerPosition rb = new PlayerPosition();
            rb.PlayerPositionId = 2;
            rb.Position = "RB";
            rb.Description = "Defender";
            positions.Add(rb);

            PlayerPosition cb = new PlayerPosition();
            cb.PlayerPositionId = 3;
            cb.Position = "CB";
            cb.Description = "Defender";
            positions.Add(cb);

            PlayerPosition lb = new PlayerPosition();
            lb.PlayerPositionId = 4;
            lb.Position = "LB";
            lb.Description = "Defender";
            positions.Add(lb);

            PlayerPosition rm = new PlayerPosition();
            rm.PlayerPositionId = 5;
            rm.Position = "RM";
            rm.Description = "Midfielder";
            positions.Add(rm);

            PlayerPosition ram = new PlayerPosition();
            ram.PlayerPositionId = 6;
            ram.Position = "RAM";
            ram.Description = "Midfielder";
            positions.Add(ram);

            PlayerPosition cdm = new PlayerPosition();
            cdm.PlayerPositionId = 7;
            cdm.Position = "CDM";
            cdm.Description = "Midfielder";
            positions.Add(cdm);

            PlayerPosition cm = new PlayerPosition();
            cm.PlayerPositionId = 8;
            cm.Position = "CM";
            cm.Description = "Midfielder";
            positions.Add(cm);

            PlayerPosition cam = new PlayerPosition();
            cam.PlayerPositionId = 9;
            cam.Position = "CAM";
            cam.Description = "Midfielder";
            positions.Add(cam);

            PlayerPosition lam = new PlayerPosition();
            lam.PlayerPositionId = 10;
            lam.Position = "LAM";
            lam.Description = "Midfielder";
            positions.Add(lam);

            PlayerPosition lm = new PlayerPosition();
            lm.PlayerPositionId = 11;
            lm.Position = "LM";
            lm.Description = "Midfielder";
            positions.Add(lm);

            PlayerPosition rw = new PlayerPosition();
            rw.PlayerPositionId = 12;
            rw.Position = "RW";
            rw.Description = "Forward";
            positions.Add(rw);

            PlayerPosition lw = new PlayerPosition();
            lw.PlayerPositionId = 13;
            lw.Position = "LW";
            lw.Description = "Forward";
            positions.Add(lw);

            PlayerPosition cf = new PlayerPosition();
            cf.PlayerPositionId = 14;
            cf.Position = "CF";
            cf.Description = "Forward";
            positions.Add(cf);

            PlayerPosition st = new PlayerPosition();
            st.PlayerPositionId = 15;
            st.Position = "ST";
            st.Description = "Forward";
            positions.Add(st);

            context.SaveChanges();

            //create Teams
            var teams = new List<Team>();
            Team lfc = new Team();
            lfc.TeamId = 1;
            lfc.Name = "Liverpool FC";
            teams.Add(lfc);

            Team lfc21 = new Team();
            lfc21.TeamId = 2;
            lfc21.Name = "Liverpool FC U-21's";
            teams.Add(lfc21);

            context.SaveChanges();

            //create Players
            var players = new List<Player>();
            Player player = new Player();
            player.Image = "Mignolet.jpg";
            player.FirstName = "Simon";
            player.LastName = "Mignolet";
            player.Age = 27;
            player.Nationality = "Belgium";
            player.SquadNumber = 22;
            player.PlayerPositionId = 5;
            players.Add(player);

            Player playerTwo = new Player();
            playerTwo.Image = "Bogdan.jpg";
            playerTwo.FirstName = "Adam";
            playerTwo.LastName = "Bogdan";
            playerTwo.Age = 28;
            playerTwo.Nationality = "Hungary";
            playerTwo.SquadNumber = 34;
            players.Add(playerTwo);

            Player playerThree = new Player();
            playerThree.Image = "Fulton.jpg";
            playerThree.FirstName = "Ryan";
            playerThree.LastName = "Fulton";
            playerThree.Age = 19;
            playerThree.Nationality = "England";
            playerThree.SquadNumber = 39;
            players.Add(playerThree);

            Player playerFour = new Player();
            playerFour.Image = "Clyne.jpg";
            playerFour.FirstName = "Nathaniel";
            playerFour.LastName = "Clyne";
            playerFour.Age = 24;
            playerFour.Nationality = "England";
            playerFour.SquadNumber = 2;
            players.Add(playerFour);

            Player playerFive = new Player();
            playerFive.Image = "Flanagan.jpg";
            playerFive.FirstName = "Jon";
            playerFive.LastName = "Flanagan";
            playerFive.Age = 22;
            playerFive.Nationality = "England";
            playerFive.SquadNumber = 38;
            players.Add(playerFive);

            Player playerSix = new Player();
            playerSix.Image = "Toure.jpg";
            playerSix.FirstName = "Kolo";
            playerSix.LastName = "Toure";
            playerSix.Age = 34;
            playerSix.Nationality = "Ivory Coast";
            playerSix.SquadNumber = 4;
            players.Add(playerSix);

            Player playerSeven = new Player();
            playerSeven.Image = "Lovren.jpg";
            playerSeven.FirstName = "Dejan";
            playerSeven.LastName = "Lovren";
            playerSeven.Age = 26;
            playerSeven.Nationality = "Croatia";
            playerSeven.SquadNumber = 6;
            players.Add(playerSeven);

            Player playerEight = new Player();
            playerEight.Image = "Skrtel.jpg";
            playerEight.FirstName = "Martin";
            playerEight.LastName = "Skrtel";
            playerEight.Age = 30;
            playerEight.Nationality = "Slovenia";
            playerEight.SquadNumber = 37;
            players.Add(playerEight);

            Player playerNine = new Player();
            playerNine.Image = "Sakho.jpg";
            playerNine.FirstName = "Mamadou";
            playerNine.LastName = "Sakho";
            playerNine.Age = 25;
            playerNine.Nationality = "France";
            playerNine.SquadNumber = 17;
            players.Add(playerNine);

            Player playerTen = new Player();
            playerTen.Image = "Gomez.jpg";
            playerTen.FirstName = "Joe";
            playerTen.LastName = "Gomez";
            playerTen.Age = 18;
            playerTen.Nationality = "England";
            playerTen.SquadNumber = 12;
            players.Add(playerTen);

            Player playerEleven = new Player();
            playerEleven.Image = "Cleary.jpg";
            playerEleven.FirstName = "Daniel";
            playerEleven.LastName = "Cleary";
            playerEleven.Age = 19;
            playerEleven.Nationality = "Ireland";
            playerEleven.SquadNumber = 58;
            players.Add(playerEleven);

            Player playerTwelve = new Player();
            playerTwelve.Image = "Moreno.jpg";
            playerTwelve.FirstName = "Alberto";
            playerTwelve.LastName = "Moreno";
            playerTwelve.Age = 23;
            playerTwelve.Nationality = "Spain";
            playerTwelve.SquadNumber = 18;
            players.Add(playerTwelve);

            Player playerThirtheen = new Player();
            playerThirtheen.Image = "Enrique.jpg";
            playerThirtheen.FirstName = "Jose";
            playerThirtheen.LastName = "Enrique";
            playerThirtheen.Age = 29;
            playerThirtheen.Nationality = "Spain";
            playerThirtheen.SquadNumber = 3;
            players.Add(playerThirtheen);

            Player playerFourteen = new Player();
            playerFourteen.Image = "Ibe.jpg";
            playerFourteen.FirstName = "Jordan";
            playerFourteen.LastName = "Ibe";
            playerFourteen.Age = 19;
            playerFourteen.Nationality = "England";
            playerFourteen.SquadNumber = 33;
            players.Add(playerFourteen);

            Player playerFiveteen = new Player();
            playerFiveteen.Image = "Lucas.jpg";
            playerFiveteen.FirstName = "Lucas";
            playerFiveteen.LastName = "Leiva";
            playerFiveteen.Age = 28;
            playerFiveteen.Nationality = "Brazil";
            playerFiveteen.SquadNumber = 21;
            players.Add(playerFiveteen);

            Player playerSixteen = new Player();
            playerSixteen.Image = "Can.jpg";
            playerSixteen.FirstName = "Emre";
            playerSixteen.LastName = "Can";
            playerSixteen.Age = 21;
            playerSixteen.Nationality = "Germany";
            playerSixteen.SquadNumber = 23;
            players.Add(playerSixteen);

            Player playerSeventeen = new Player();
            playerSeventeen.Image = "Rossiter.jpg";
            playerSeventeen.FirstName = "Jordan";
            playerSeventeen.LastName = "Rossiter";
            playerSeventeen.Age = 18;
            playerSeventeen.Nationality = "England";
            playerSeventeen.SquadNumber = 46;
            players.Add(playerSeventeen);

            Player playerEighteen = new Player();
            playerEighteen.Image = "Allen.jpg";
            playerEighteen.FirstName = "Joe";
            playerEighteen.LastName = "Allen";
            playerEighteen.Age = 25;
            playerEighteen.Nationality = "Wales";
            playerEighteen.SquadNumber = 24;
            players.Add(playerEighteen);

            Player playerNineteen = new Player();
            playerNineteen.Image = "Henderson.jpg";
            playerNineteen.FirstName = "Jordan";
            playerNineteen.LastName = "Henderson";
            playerNineteen.Age = 25;
            playerNineteen.Nationality = "England";
            playerNineteen.SquadNumber = 14;
            players.Add(playerNineteen);

            Player playerTwenty = new Player();
            playerTwenty.Image = "Milner.jpg";
            playerTwenty.FirstName = "James";
            playerTwenty.LastName = "Milner";
            playerTwenty.Age = 29;
            playerTwenty.Nationality = "England";
            playerTwenty.SquadNumber = 7;
            players.Add(playerTwenty);

            Player playerTwentyOne = new Player();
            playerTwentyOne.Image = "Randall.jpg";
            playerTwentyOne.FirstName = "Connor";
            playerTwentyOne.LastName = "Randall";
            playerTwentyOne.Age = 20;
            playerTwentyOne.Nationality = "England";
            playerTwentyOne.SquadNumber = 56;
            players.Add(playerTwentyOne);

            Player playerTwentyTwo = new Player();
            playerTwentyTwo.Image = "Chirivella.jpg";
            playerTwentyTwo.FirstName = "Pedro";
            playerTwentyTwo.LastName = "Chirivella";
            playerTwentyTwo.Age = 18;
            playerTwentyTwo.Nationality = "Spain";
            playerTwentyTwo.SquadNumber = 68;
            players.Add(playerTwentyTwo);

            Player playerTwentyThree = new Player();
            playerTwentyThree.Image = "Dunn.jpg";
            playerTwentyThree.FirstName = "Jack";
            playerTwentyThree.LastName = "Dunn";
            playerTwentyThree.Age = 21;
            playerTwentyThree.Nationality = "England";
            playerTwentyThree.SquadNumber = 41;
            players.Add(playerTwentyThree);

            Player playerTwentyFour = new Player();
            playerTwentyFour.Image = "Brannagan.jpg";
            playerTwentyFour.FirstName = "Cameron";
            playerTwentyFour.LastName = "Brannagan";
            playerTwentyFour.Age = 19;
            playerTwentyFour.Nationality = "England";
            playerTwentyFour.SquadNumber = 32;
            players.Add(playerTwentyFour);

            Player playerT = new Player();
            playerT.Image = "Teixeira.jpg";
            playerT.FirstName = "João Carlos";
            playerT.LastName = "Teixeira";
            playerT.Age = 22;
            playerT.Nationality = "Portugal";
            playerT.SquadNumber = 53;
            players.Add(playerT);

            Player playerTwentyFive = new Player();
            playerTwentyFive.Image = "Lallana.jpg";
            playerTwentyFive.FirstName = "Adam";
            playerTwentyFive.LastName = "Lallana";
            playerTwentyFive.Age = 27;
            playerTwentyFive.Nationality = "England";
            playerTwentyFive.SquadNumber = 20;
            players.Add(playerTwentyFive);

            Player playerTwentySix = new Player();
            playerTwentySix.Image = "Coutinho.jpg";
            playerTwentySix.FirstName = "Philippe";
            playerTwentySix.LastName = "Coutinho";
            playerTwentySix.Age = 23;
            playerTwentySix.Nationality = "Brazil";
            playerTwentySix.SquadNumber = 10;
            players.Add(playerTwentySix);

            Player playerTwentySeven = new Player();
            playerTwentySeven.Image = "Firmino.jpg";
            playerTwentySeven.FirstName = "Roberto";
            playerTwentySeven.LastName = "Firmino";
            playerTwentySeven.Age = 24;
            playerTwentySeven.Nationality = "Brazil";
            playerTwentySeven.SquadNumber = 11;
            players.Add(playerTwentySeven);

            Player playerTwentyEight = new Player();
            playerTwentyEight.Image = "Origi.jpg";
            playerTwentyEight.FirstName = "Divock";
            playerTwentyEight.LastName = "Origi";
            playerTwentyEight.Age = 20;
            playerTwentyEight.Nationality = "Belgium";
            playerTwentyEight.SquadNumber = 27;
            players.Add(playerTwentyEight);

            Player playerTwentyNine = new Player();
            playerTwentyNine.Image = "Ings.jpg";
            playerTwentyNine.FirstName = "Danny";
            playerTwentyNine.LastName = "Ings";
            playerTwentyNine.Age = 23;
            playerTwentyNine.Nationality = "England";
            playerTwentyNine.SquadNumber = 28;
            players.Add(playerTwentyNine);

            Player playerThirthy = new Player();
            playerThirthy.Image = "Benteke.jpg";
            playerThirthy.FirstName = "Christian";
            playerThirthy.LastName = "Benteke";
            playerThirthy.Age = 24;
            playerThirthy.Nationality = "Belgium";
            playerThirthy.SquadNumber = 9;
            players.Add(playerThirthy);

            Player playerThirthyOne = new Player();
            playerThirthyOne.Image = "Sturridge.jpg";
            playerThirthyOne.FirstName = "Daniel";
            playerThirthyOne.LastName = "Sturridge";
            playerThirthyOne.Age = 26;
            playerThirthyOne.Nationality = "England";
            playerThirthyOne.SquadNumber = 15;
            players.Add(playerThirthyOne);

            Player playerThirthyTwo = new Player();
            playerThirthyTwo.Image = "Sinclair.jpg";
            playerThirthyTwo.FirstName = "Jerome";
            playerThirthyTwo.LastName = "Sinclair";
            playerThirthyTwo.Age = 19;
            playerThirthyTwo.Nationality = "England";
            playerThirthyTwo.SquadNumber = 48;
            players.Add(playerThirthyTwo);

            //create Fixtures
            var fixtures = new List<Fixture>();
            Fixture fixture = new Fixture();
            fixture.Date = DateTime.Parse("2015-07-14 14:00:00");
            fixture.Stadium = "Rajamangala National Stadium";
            fixture.HomeTeam = "Thailand All-Stars";
            fixture.HomeScore = 0;
            fixture.AwayScore = 4;
            fixture.AwayTeam = "Liverpool";
            fixtures.Add(fixture);

            Fixture fixtureTwo = new Fixture();
            fixtureTwo.Date = DateTime.Parse("2015-07-17 09:45:00");
            fixtureTwo.Stadium = "Suncorp Stadium";
            fixtureTwo.HomeTeam = "Brisbane";
            fixtureTwo.HomeScore = 1;
            fixtureTwo.AwayScore = 2;
            fixtureTwo.AwayTeam = "Liverpool";
            fixtures.Add(fixtureTwo);

            Fixture fixtureThree = new Fixture();
            fixtureThree.Date = DateTime.Parse("2015-07-20 10:30:00");
            fixtureThree.Stadium = "Coopers Stadium";
            fixtureThree.HomeTeam = "Adelaide United";
            fixtureThree.HomeScore = 0;
            fixtureThree.AwayScore = 2;
            fixtureThree.AwayTeam = "Liverpool";
            fixtures.Add(fixtureThree);

            Fixture fixtureFour = new Fixture();
            fixtureFour.Date = DateTime.Parse("2015-07-24 13:45:00");
            fixtureFour.Stadium = "Bukit Jalil National Stadium";
            fixtureFour.HomeTeam = "Malaysia All-Stars XI";
            fixtureFour.HomeScore = 1;
            fixtureFour.AwayScore = 1;
            fixtureFour.AwayTeam = "Liverpool";
            fixtures.Add(fixtureFour);

            Fixture fixtureFive = new Fixture();
            fixtureFive.Date = DateTime.Parse("2015-08-01 17:30:00");
            fixtureFive.Stadium = "Sonera Stadium";
            fixtureFive.HomeTeam = "HJK Helsinki";
            fixtureFive.HomeScore = 0;
            fixtureFive.AwayScore = 2;
            fixtureFive.AwayTeam = "Liverpool";
            fixtures.Add(fixtureFive);

            Fixture fixtureSix = new Fixture();
            fixtureSix.Date = DateTime.Parse("2015-08-02 16:00:00");
            fixtureSix.Stadium = "The County Ground";
            fixtureSix.HomeTeam = "Swindon Town";
            fixtureSix.HomeScore = 1;
            fixtureSix.AwayScore = 2;
            fixtureSix.AwayTeam = "Liverpool";
            fixtures.Add(fixtureSix);

            //create Honours
            var honours = new List<Honour>();
            Honour league = new Honour();
            league.Image = "pl.png";
            league.Award = "League Champions";
            league.Amount = 18;
            league.Season = "1900-01, 1905-06, 1921-22, 1922-23, 1946-47, 1963-64, 1965-66, 1972-73, 1975-76, 1976-77, 1978-79, 1979-80, 1981-82, 1982-83, 1983-84, 1985-86, 1987-88, 1989-90";
            league.Type = "Domestic";
            honours.Add(league);

            Honour faCup = new Honour();
            faCup.Image = "faTrophy.png";
            faCup.Award = "FA Cup";
            faCup.Amount = 7;
            faCup.Season = "1964-65, 1973-74, 1985-86, 1988-89, 1991-92, 2000-01, 2005-06";
            faCup.Type = "Domestic";
            honours.Add(faCup);

            Honour capCup = new Honour();
            capCup.Image = "lc.png";
            capCup.Award = "Capital One Cup";
            capCup.Amount = 8;
            capCup.Season = "1980-81, 1981-82, 1982-83, 1983-84, 1994-95, 2000-01, 2002-03, 2011-12";
            capCup.Type = "Domestic";
            honours.Add(capCup);

            Honour charity = new Honour();
            charity.Image = "cs.png";
            charity.Award = "FA Community Shield Winner";
            charity.Amount = 15;
            charity.Season = "1964, 1965, 1966, 1974, 1976, 1977, 1979, 1980, 1982, 1986, 1988, 1989, 1990, 2001, 2006";
            charity.Type = "Domestic";
            honours.Add(charity);

            Honour euro = new Honour();
            euro.Image = "cl.png";
            euro.Award = "UEFA Champions League";
            euro.Amount = 5;
            euro.Season = "1976-77, 1977-78, 1980-81, 1983-84, 2004-05";
            euro.Type = "International";
            honours.Add(euro);

            Honour europaL = new Honour();
            europaL.Image = "el.png";
            europaL.Award = "UEFA Europa-League";
            europaL.Amount = 3;
            europaL.Season = "1972-73, 1975-76, 2000-01";
            europaL.Type = "International";
            honours.Add(europaL);

            Honour superCap = new Honour();
            superCap.Image = "sc.png";
            superCap.Award = "European Super Cup Winners";
            superCap.Amount = 3;
            superCap.Season = "1977, 2001, 2005";
            superCap.Type = "International";
            honours.Add(superCap);

            //create Managers
            var managers = new List<Manager>();
            Manager john = new Manager();
            john.Image = "McKenna.jpg";
            john.FirstName = "John";
            john.LastName = "McKenna";
            john.DOB = DateTime.Parse("1855/01/03");
            john.Nationality = "Ireland";
            john.Period = "1892-1896";
            managers.Add(john);

            Manager tom = new Manager();
            tom.Image = "Watson.jpg";
            tom.FirstName = "Tom";
            tom.LastName = "Watson";
            tom.DOB = DateTime.Parse("1859/04/09");
            tom.Nationality = "England";
            tom.Period = "1896-1915";
            managers.Add(tom);

            Manager david = new Manager();
            david.Image = "Ashworth.jpg";
            david.FirstName = "David";
            david.LastName = "Ashworth";
            david.DOB = DateTime.Parse("1868/01/01");
            david.Nationality = "Ireland";
            david.Period = "1919-1922";
            managers.Add(david);

            Manager matt = new Manager();
            matt.Image = "McQueen.jpg";
            matt.FirstName = "Matt";
            matt.LastName = "McQueen";
            matt.DOB = DateTime.Parse("1863/05/18");
            matt.Nationality = "England";
            matt.Period = "1923-1928";
            managers.Add(matt);

            Manager george = new Manager();
            george.Image = "Patterson.jpg";
            george.FirstName = "George";
            george.LastName = "Patterson";
            george.DOB = DateTime.Parse("1887/01/01");
            george.Nationality = "Scotland";
            george.Period = "1928-1936";
            managers.Add(george);

            Manager kay = new Manager();
            kay.Image = "Kay.jpg";
            kay.FirstName = "George";
            kay.LastName = "Kay";
            kay.DOB = DateTime.Parse("1891/09/21");
            kay.Nationality = "England";
            kay.Period = "1936-1951";
            managers.Add(kay);

            Manager don = new Manager();
            don.Image = "Welsh.jpg";
            don.FirstName = "Don";
            don.LastName = "Welsh";
            don.DOB = DateTime.Parse("1911/02/25");
            don.Nationality = "England";
            don.Period = "1951-1956";
            managers.Add(don);

            Manager phil = new Manager();
            phil.Image = "Taylor.jpg";
            phil.FirstName = "Phil";
            phil.LastName = "Taylor";
            phil.DOB = DateTime.Parse("1917/09/18");
            phil.Nationality = "England";
            phil.Period = "1956-1959";
            managers.Add(phil);

            Manager bill = new Manager();
            bill.Image = "Shankley.jpg";
            bill.FirstName = "Bill";
            bill.LastName = "Shankly";
            bill.DOB = DateTime.Parse("1913/09/02");
            bill.Nationality = "Scotland";
            bill.Period = "1959-1974";
            managers.Add(bill);

            Manager bob = new Manager();
            bob.Image = "Paisley.jpg";
            bob.FirstName = "Bob";
            bob.LastName = "Paisley";
            bob.DOB = DateTime.Parse("1919/01/23");
            bob.Nationality = "England";
            bob.Period = "1974-1983";
            managers.Add(bob);

            Manager fagan = new Manager();
            fagan.Image = "Fagan.jpg";
            fagan.FirstName = "Joe";
            fagan.LastName = "Fagan";
            fagan.DOB = DateTime.Parse("1921/03/12");
            fagan.Nationality = "England";
            fagan.Period = "1983-1985";
            managers.Add(fagan);

            Manager kenny = new Manager();
            kenny.Image = "Dalglish.jpg";
            kenny.FirstName = "Kenny";
            kenny.LastName = "Dalglish";
            kenny.DOB = DateTime.Parse("1951/03/04");
            kenny.Nationality = "Scotland";
            kenny.Period = "1985-1991";
            managers.Add(kenny);

            Manager souness = new Manager();
            souness.Image = "Souness.jpg";
            souness.FirstName = "Graeme";
            souness.LastName = "Souness";
            souness.DOB = DateTime.Parse("1953/05/06");
            souness.Nationality = "Scotland";
            souness.Period = "1991-1994";
            managers.Add(souness);

            Manager evans = new Manager();
            evans.Image = "Evans.jpg";
            evans.FirstName = "Roy";
            evans.LastName = "Evans";
            evans.DOB = DateTime.Parse("1948/10/04");
            evans.Nationality = "England";
            evans.Period = "1994-1998";
            managers.Add(evans);

            Manager houllier = new Manager();
            houllier.Image = "Houllier.jpg";
            houllier.FirstName = "Gerard";
            houllier.LastName = "Houllier";
            houllier.DOB = DateTime.Parse("1947/09/03");
            houllier.Nationality = "France";
            houllier.Period = "1998-2004";
            managers.Add(houllier);

            Manager rafa = new Manager();
            rafa.Image = "Benitez.jpg";
            rafa.FirstName = "Rafael";
            rafa.LastName = "Benitez";
            rafa.DOB = DateTime.Parse("1960/04/16");
            rafa.Nationality = "Spain";
            rafa.Period = "2004-2010";
            managers.Add(rafa);

            Manager hodgson = new Manager();
            hodgson.Image = "Hodgson.jpg";
            hodgson.FirstName = "Roy";
            hodgson.LastName = "Hodgson";
            hodgson.DOB = DateTime.Parse("1947/08/09");
            hodgson.Nationality = "England";
            hodgson.Period = "2010-2011";
            managers.Add(hodgson);

            Manager kennyTwo = new Manager();
            kennyTwo.Image = "DalglishTwo.jpg";
            kennyTwo.FirstName = "Kenny";
            kennyTwo.LastName = "Dalglish";
            kennyTwo.DOB = DateTime.Parse("1951/03/04");
            kennyTwo.Nationality = "Scotland";
            kennyTwo.Period = "2011-2012";
            managers.Add(kennyTwo);

            Manager rodgers = new Manager();
            rodgers.Image = "Rodgers.jpg";
            rodgers.FirstName = "Brendan";
            rodgers.LastName = "Rodgers";
            rodgers.DOB = DateTime.Parse("1973/01/26");
            rodgers.Nationality = "Northern Ireland";
            rodgers.Period = "2012-2015";
            managers.Add(rodgers);

            Manager klopp = new Manager();
            klopp.Image = "Klopp.jpeg";
            klopp.FirstName = "Jurgen";
            klopp.LastName = "Klopp";
            klopp.DOB = DateTime.Parse("1967/06/16");
            klopp.Nationality = "Germany";
            klopp.Period = "2015-Present";
            managers.Add(klopp);

            epl.Fixtures = fixtures;
            /*fa.Fixtures = fixtures;
            capital.Fixtures = fixtures;
            europa.Fixtures = fixtures;
            friendly.Fixtures = fixtures;*/

            player.Fixtures = fixtures;

            fixture.Players = players;
            fixtureTwo.Players = players;
            fixtureThree.Players = players;
            fixtureFour.Players = players;
            fixtureFive.Players = players;
            fixtureSix.Players = players;

            john.Honours = honours;
            league.Managers = managers;

            gk.Players = players;
            /*rb.Players = players;
            cb.Players = players;
            lb.Players = players;
            rm.Players = players;
            ram.Players = players;
            cdm.Players = players;
            cm.Players = players;
            cam.Players = players;
            lam.Players = players;
            lm.Players = players;
            rw.Players = players;
            lw.Players = players;
            cf.Players = players;
            st.Players = players;*/

            lfc.Players = players;
            //lfc21.Players = players;

            foreach (var c in competitions)
            {
                context.Competitions.Add(c);
            }

            foreach (var po in positions)
            {
                context.PlayerPositions.Add(po);
            }

            foreach (var t in teams)
            {
                context.Teams.Add(t);
            }

            foreach (var p in players)
            {
                context.Players.Add(p);
            }

            foreach (var f in fixtures)
            {
                context.Fixtures.Add(f);
            }

            foreach (var h in honours)
            {
                context.Honours.Add(h);
            }

            foreach (var m in managers)
            {
                context.Managers.Add(m);
            }

            context.SaveChanges();
        }
 public void MSTest_AutoData_Freeze(Fixture fixture, [Freeze] int froozen)
 {
     fixture.Generate <int>().Should().Be(froozen);
 }
 public void MSTest_AutoData_LocateValue(Fixture fixture, [Locate(Value = 8)] int locate)
 {
     locate.Should().Be(8);
 }
 public PubSubRendezvousGrainTests(Fixture fixture)
 {
     this.fixture = fixture;
 }
 public void MSTest_AutoData_FreezeValue(Fixture fixture, [Freeze(Value = 8)] int froozen)
 {
     froozen.Should().Be(8);
     fixture.Generate <int>().Should().Be(froozen);
 }
Exemplo n.º 49
0
        public void ChemicalProcessing_ValidMol_GenerateOnlyOneRecord()
        {
            var recordIds = Fixture.GetProcessedRecords(FileId);

            recordIds.Should().HaveCount(1);
        }
 public void MSTest_AutoData_ProvidesFixture(Fixture fixture)
 {
     fixture.Should().NotBeNull();
 }
 public EHImplicitSubscriptionStreamRecoveryTests(Fixture fixture)
 {
     this.fixture = fixture;
     fixture.EnsurePreconditionsMet();
     this.runner = new ImplicitSubscritionRecoverableStreamTestRunner(this.fixture.GrainFactory, StreamProviderName);
 }
Exemplo n.º 52
0
        public async Task ChemicalProcessing_ValidMol_There_Are_No_Errors()
        {
            Fixture.GetFaults().Should().BeEmpty();

            await Task.CompletedTask;
        }
Exemplo n.º 53
0
        public static NoteDb CreateDatabaseEntity()
        {
            var note = new Fixture().Create <Note>();

            return(note.ToDatabase());
        }
 public create_duplicate(Fixture fixture)
 {
     _fixture = fixture;
 }
        private const int DELAY_UNTIL_INDEXES_ARE_UPDATED_LAZILY = 1000; //one second delay for writes to the in-memory indexes should be enough

        public StorageManagedIndexingTests(Fixture fixture, ITestOutputHelper output)
        {
            this.output = output;
        }
 public void SetUp()
 {
     _validatorMockContext = new ValidatorMockContext();
     _fixture = new Fixture();
 }
Exemplo n.º 57
0
 public bool MyOnCollision(Fixture f1, Fixture f2, Contact contact)
 {
     return(f2.Body.BodyName == null);
 }
Exemplo n.º 58
0
 public CinemaRepositoryTests()
 {
     _fixture = new Fixture();
     _cinemaShowRepository = (CinemaShowRepository)RepositorySetup.GetInMemoryCinemaShowRespository(Guid.NewGuid().ToString(), _fixture);
 }
 public DeleteItemCommandHandler CreateCommandHandler()
 {
     return(Fixture.Create <DeleteItemCommandHandler>());
 }
 public stream_security_inheritance(Fixture fixture)
 {
     _fixture = fixture;
 }