Example #1
0
            public void Inheritence()
            {
                var request = new GetAllPlatformsRequest(FakeRepository, FakeRepositoryAggregate);

                request.Should().NotBeNull();
                request.Should().BeAssignableTo <IGetAllPlatformsRequest>();
                request.Should().BeAssignableTo <BaseServiceRequest <Domain.Platform.Entities.Platform> >();
                request.Should().BeOfType <GetAllPlatformsRequest>();
            }
Example #2
0
            public void Execute()
            {
                var platforms = MockData.Mocks.GeneratePlatforms().ToArray();

                A.CallTo(getAll).Returns(platforms);

                request.Should().NotBeNull();

                var response = request.Execute();

                response.Should().NotBeNull();
                response.Should().BeOfType <PlatformListResponse>();

                response.Platforms.Should().NotBeNullOrEmpty();
                response.ErrorResponse.Should().BeNull();

                response.Platforms.Count().Should().Be(platforms.Length);

                A.CallTo(getAll).MustHaveHappened(Repeated.Exactly.Once);
            }
Example #3
0
            public void Execute()
            {
                Expression <Func <IEnumerable <Domain.Platform.Entities.Platform> > > getAll = () => FakeRepository.GetAll();

                var platforms = TestData.GetPlatforms().ToArray();

                A.CallTo(getAll).Returns(platforms);

                var request = new GetAllPlatformsRequest(FakeRepository, FakeRepositoryAggregate);

                request.Should().NotBeNull();

                var response = request.Execute();

                response.Should().NotBeNull();
                response.Should().BeOfType <PlatformListResponse>();

                response.Platforms.Should().NotBeNullOrEmpty();

                //platform 1 result
                var nes = response.Platforms.ElementAt(0);

                CheckValues(nes, platforms.Single(p => p.Id == 1));

                //platform 2 result
                var snes = response.Platforms.ElementAt(1);

                CheckValues(snes, platforms.Single(p => p.Id == 2));

                void CheckValues(IPlatform platform, IPlatform expected)
                {
                    platform.Should().NotBeNull();
                    platform.Id.Should().Be(expected.Id);
                    platform.Name.Should().BeEquivalentTo(expected.Name);
                    platform.ReleaseDate.Should().Be(expected.ReleaseDate);
                }

                A.CallTo(getAll).MustHaveHappened(Repeated.Exactly.Once);
            }
Example #4
0
 public void InheritsFromIGetAllPlatformsRequests()
 {
     request.Should().BeAssignableTo <IGetAllPlatformsRequest>();
 }